https://bugs.winehq.org/show_bug.cgi?id=57817
Bug ID: 57817 Summary: mvscp90 ::std::ifstream::seekg(0) crashes Product: Wine Version: 10.1 Hardware: x86-64 OS: FreeBSD Status: NEW Keywords: source, testcase Severity: normal Priority: P2 Component: msvcp Assignee: wine-bugs@winehq.org Reporter: damjan.jov@gmail.com
Wine can be crashed as easily as calling seekg(0) on an ::std::ifstream when linked with MSVCP90.DLL.
Sample crash code, compile it so it uses MSVCP90.DLL and run with any "test.txt" in the current directory:
---snip--- #include <iostream> // std::cout #include <fstream> // std::ifstream
int main (int argc, char **argv) { ::std::ifstream is ("test.txt", ::std::ifstream::binary); if (is) { // crashes: is.seekg(0); // doesn't crash: //is.seekg(0, ::std::ios::beg); return 0; } else return 1; } ---snip---
On Windows it works, and on Wine with native MSVCP90.DLL and MSVCRT90.DLL it works, but on Wine with builtin DLLs:
056c:Call msvcp90.?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z(0031fe38,00000000,0031fe38,000000000,00000000,00000001) ret=1b001086 056c:Call msvcr90.memcpy(0031fd68,00000000,00000018) ret=7a023138 056c:trace:seh:dispatch_exception code=c0000005 (EXCEPTION_ACCESS_VIOLATION) flags=0 addr=79F7F538
What's interesting is how calling is.seekg(0, ::std::ios::beg) instead works perfectly on Wine with builtin DLLs.