OrangeC icon indicating copy to clipboard operation
OrangeC copied to clipboard

LibFIles::ReadOffsets not having the count be the same as files

Open chuggafan opened this issue 3 years ago • 3 comments

I've been recently having an error where the assert for LibFiles::ReadOffsets in LibFilesLinker.cpp has been failing for an unknown reason, normally only occuring when using one of the *compiles.bat systems, I'm partially inquiring as to if anyone else has noticed this and if there's any easy way to debug what or where the root cause can be, if need be I'll bisect the entire git repository for this.

chuggafan avatar Aug 03 '22 04:08 chuggafan

i saw something weird the other day, but I don't know where it was or what it was, and when I tried to replicate it the problem went away. That was when using the BUILD.BAT script.

count has to match files.size();

files is populated in ReadNames() in the same file. So that is what count has to match...

ReadNames and ReadOffsets are called in sequence like this:

    if (!files.ReadNames(stream, header.filesInModule))
        return false;
    if (fseek(stream, header.offsetsOffset, SEEK_SET))
        return false;
    if (!files.ReadOffsets(stream, header.filesInModule))
        return false;

so that kinda indicates that either the header structure is getting corrupted somehow so that the 'count' argument for the two calls doesn't match, or there is bad code generation for one of those two functions... maybe some printfs would clarify which is happening...

LADSoft avatar Aug 04 '22 00:08 LADSoft

This issue appears to have been resolved between commits 50e02d0115c9d25ada05c54e7354ecf69bde6b43 and 41f715d40e8ea50f96082fc120d71a21663a6ebd

I will investigate likely next week which commit it was so I can figure out what went wrong because it's working and nothing seems to have touched it

EDIT: I'm not confused because the commit I thought had the known issue doesn't?!? I'm investigating how far back I have to go to get errors at the moment but I'm not happy at being this confused for little to no reason.

EDIT 2: Found a broken commit, will bisect Soon:tm: when I find the time, I updated the commit in the original message

chuggafan avatar Sep 08 '22 02:09 chuggafan

git bisect

should find the issue for you most easily.

GitMensch avatar Sep 08 '22 04:09 GitMensch

any news on this?

LADSoft avatar Jun 24 '23 02:06 LADSoft

I honestly completely forgot about this. I don't think I see the issue anymore but I haven't tested much lately as I've been focusing on implementing #embed slowly but surely

chuggafan avatar Jun 24 '23 03:06 chuggafan

ok. I forgot you were working on #embed...

LADSoft avatar Jun 24 '23 07:06 LADSoft

Im going to close it, please reopen if the issue resurfaces.

LADSoft avatar Jun 26 '23 18:06 LADSoft