[Bug 37940] Invalid file buffering behavior causes data corruption

wine-bugs at winehq.org wine-bugs at winehq.org
Thu Jan 22 14:27:04 CST 2015


https://bugs.winehq.org/show_bug.cgi?id=37940

--- Comment #3 from Mikhail Bystryantsev <ho-rr-or at mail.ru> ---
Created attachment 50553
  --> https://bugs.winehq.org/attachment.cgi?id=50553
Second binary for reproduce

There is new binary for reproduce. I reproduced a nearly the same operations
that performs cl.exe.

    char data[68100 + 65536];
    char buf[sizeof(data)];
    for (int i = 0; i < sizeof(data); i++)
        data[i] = rand();

    FILE* f = _wfsopen(L"test.bin", L"wb+", 64);

    rewind(f);
    fwrite(data, 1, 68100, f);

    // Following calls possible corrupt buffer
    rewind(f);
    fread(buf, 1, 32512, f);
    fread(buf, 1, 4096, f);
    fread(buf, 1, 28672, f);
    fread(buf, 1, 4096, f);    
    fread(buf, 1, 29948, f);

    // Following call causes wrong buffer flushing
    fwrite(&data[68100], 1, 65536, f);

    fclose(f);

    f = fopen("test.bin", "rb");
    fread(buf, 1, sizeof(buf), f);
    fclose(f);
    printf("Memcmp: %d\n", memcmp(data, buf, sizeof(buf)));

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list