Parser example hangs on empty blf files

Issue #6 closed
Dennis Delin created an issue

The example hangs when try to parse an empty blf file. Working solution to add a check in main before the while loop.

    Vector::BLF::FileStatistics * stat = &file.fileStatistics;
    show(stat);

    if (stat->objectCount <= 0) {
        std::cout << "No objects found in file." << std::endl;
        return 1;
    }

Comments (8)

  1. Tobias Lorenz repo owner

    I'm currently working in this too. I found a good way to generate blf files under Windows. With these blfs I now have a way to complete the unit tests for all 100 object types. 30% of unit tests are complete now. And I hope to finalize the remaining (Lin, Ethernet, FlexRay, Most) till the weekend and then also release the blf generator. During these tests I found already that there are issues with the compression/uncompression and general file read/write handling. Maybe the empty file issue is already solved. I'll add a unit test for this as well.

  2. Tobias Lorenz repo owner

    I finished with unit test implementations, but still have some original blf files, where the parser hangs due to inability to read sufficient input data. The best approach to tackle this is to introduce error checking and handling for all read/write access. The is more generic then trusting and checking objectCount. I'll see what I can do today.

  3. Dennis Delin reporter

    Hi,

    Now I have an more severe issue, trying to parse a logfile and after a few CanMessages i get a Vector::BLF::ObjectSignatureMsimatch error, and no futher printout.

  4. Tobias Lorenz repo owner

    Hi Dennis,

    I've created now test cases for all ~100 object types and did many fixes in the last days. Can you give it a try? If it still hangs or throws exceptions, can you send me your blf file?

    The ObjectSignatureMismatch exception means that the library tried to read an object at a wrong position. Hence he doesn't see the object signature ("LOBJ") there and stops. With the latest commit I also changed the Exception class(es) and use it in more locations to provide more detailed information, when errors occur. It should also throw an exception now, if it reads beyond the file end, including the case that the file is empty. So I believe the original issue is solved now. But I'm waiting for your feedback, before I close it.

    Bye Tobias

  5. Log in to comment