You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While investigating this downstream bug, I've noticed an issue with a patch devkitPro does to newlib's fread function: https://bugs.scummvm.org/ticket/11342
The program does the following calls to trigger data corruption:
char *buffer = (char *)malloc(20*1024);
// Open a file for reading with buffered IO
FILE *f = fopen("sdmc:/ScummVM/The Dig/DIG.LA1", "r");
// Go somewhere in the file, unimportantfseek(f, 23800663, SEEK_SET);
// Initialize the stdio read bufferfread(buffer, 1, 1, f);
// Make a large read that enters devkitPro's fread patched code path.// After this, the stdio read buffer is out of sync with the stream position.fread(buffer, 1, 10096, f);
// Seek back a bit in the file. The target seek position is inside the buffer from// stdio's perspective (but actually is not as the buffer is out of sync with the actual// stream position).fseek(f, 23810752, SEEK_SET);
// Make a small read. The data is fetched from the stdio buffer. It is inconsistent with what is actually in the file.fread(buffer, 1, 4, f);
fclose(f);
While investigating this downstream bug, I've noticed an issue with a patch devkitPro does to newlib's
fread
function: https://bugs.scummvm.org/ticket/11342The program does the following calls to trigger data corruption:
I suggest reverting this patch:
newlib/newlib/libc/stdio/fread.c
Line 231 in a7caafc
The text was updated successfully, but these errors were encountered: