https://bugs.winehq.org/show_bug.cgi?id=48323
Bug ID: 48323 Summary: scanf functions do not support NaN for floating point elements Product: Wine Version: 5.0-rc2 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: msvcrt Assignee: wine-bugs@winehq.org Reporter: codedonewell@gmail.com Distribution: ---
Created attachment 66042 --> https://bugs.winehq.org/attachment.cgi?id=66042 Return zero when NaN is found while parsing floats
Star Citizen PTU Version 3.8.0 is attempting to read float values from data files that contain the text "nan". The current scanf.h implementation does not consider NaNs. This prevents this version of Star Citizen from launching when run under wine. This version does launch under windows with the same account. I have tested a patch that returns zero when a NaN is encountered, which allows this version of Star Citizen to launch. There are several considerations to be addressed in this patch: 1 - it is not locale friendly; 2 - it updates the parse pointer as it checks for the text NAN, whcih means a failure will return an incorreclty update pointer; and 3 - it returns zero when NAN is encountered rather than NAN as returning NAN still breaks this version of Star Citizen. I am keen to work up a more appropriate patch, however I need guidance regarding the decision to return zero (rather than NaN - zero works for me but might be bad), and how to look-ahead when checking for "NaN" without updating the parse pointer.
https://bugs.winehq.org/show_bug.cgi?id=48323
--- Comment #1 from Greg Smith codedonewell@gmail.com --- A followup on my 2nd concern: The string "nan" results in a correct parse pointer, but the string "nathan" will incorrectly result in a parse pointer that is pointing to "than", rather than "nathan".
https://bugs.winehq.org/show_bug.cgi?id=48323
rawfox rawfox@freenet.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |rawfox@freenet.de
--- Comment #2 from rawfox rawfox@freenet.de --- Thanks for the attached patch, the game is working again. Whatever CIG is returning there, scanf() should not crash.
https://bugs.winehq.org/show_bug.cgi?id=48323
--- Comment #3 from Greg Smith codedonewell@gmail.com --- This was never a crash in scanf - The game code was triggering an assert.
https://bugs.winehq.org/show_bug.cgi?id=48323
Greg Smith codedonewell@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |NOTOURBUG Status|UNCONFIRMED |RESOLVED
--- Comment #4 from Greg Smith codedonewell@gmail.com --- Apparently the dodgy game data, or the assert has been removed. While making scanf behave in a similar fashion to the windows versions would be nice - it is not bug critical.
https://bugs.winehq.org/show_bug.cgi?id=48323
Piotr Caban piotr.caban@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |piotr.caban@gmail.com
--- Comment #5 from Piotr Caban piotr.caban@gmail.com --- Support for nan's was recently added to scanf (commits f99d307a3e1f9beb7fd9dc8892b5cfabbabf816b, 1366dd69d5a0578299dc69365db972b0341456d2, c4ad7391956fcbfe7a1a9324ebda1e013e5f6edd and 287dabd9b6887e94cabfa2a5f9bfe822522095e5). It's only supported when ucrtbase is used (as in native implementation).
https://bugs.winehq.org/show_bug.cgi?id=48323
Piotr Caban piotr.caban@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|NOTOURBUG |FIXED
--- Comment #6 from Piotr Caban piotr.caban@gmail.com --- The bug is fixed (support for nan's was added to ucrtbase) or invalid (nan's should not be supported in older versions of runtime). Changing resolution to fixed.
https://bugs.winehq.org/show_bug.cgi?id=48323
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #7 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 6.2.