http://bugs.winehq.org/show_bug.cgi?id=2039 Summary: read float bug in scanf.h in msvcrt.dll.so Product: Wine Version: 20040213 Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wine-misc AssignedTo: wine-bugs(a)winehq.org ReportedBy: elmkni(a)freenet.de Hi, my name is Elmar Knittel (elmkni(a)freenet.de), and I might have found a little bug in wine :( I have got SuSE Linux 8.2 personal and wine-20040213-SuSELinux82.i586.rpm and wine-20040213-SuSELinux82.src.rpm from sourceforge.net/projects/wine. There seems to be problem within the scan functions in wine-20040213/dlls/msvcrt/scanf.h, line 265/266: /* get first digit. */ if (!_ISDIGIT_(nch)) break; break is triggered by decimals without leading digit, e.g: //--------------------------------------------------------------------- // // test.c - compile with MinGW under WIN32 // // DEPEND = test.c // SHRINK = upx --best --crp-ms=999999 --nrv2b // CFLAGS = -s -Os -ffast-math -DNDEBUG -mconsole -march=pentium4 // EXE = test.exe // CC = gcc // // .PHONY: $(EXE) // $(EXE): $(DEPEND) // $(CC) $(CFLAGS) $? -o$@ // $(SHRINK) $@ // //--------------------------------------------------------------------- #include <stdio.h> int main() { int i; static float r,g,b; const char *s = "0 .7 0"; printf("\n\tBefore: r = %f, g = %f, b = %f",r,g,b); i = sscanf(s,"%f %f %f",&r,&g,&b); printf("\n\tAfter : r = %f, g = %f, b = %f",r,g,b); printf("\n\tBackgroundColorString is: `%s`, Return is: %i\n\n",s,i); return 0; } //--------------------------------------------------------------------- The output of <wine test> should be: Before: r = 0.000000, g = 0.000000, b = 0.000000 After : r = 0.000000, g = 0.700000, b = 0.000000 BackgroundColorString is: `0 .7 0`, Return is: 3 but actually is: Before: r = 0.000000, g = 0.000000, b = 0.000000 After : r = 0.000000, g = 0.000000, b = 0.000000 BackgroundColorString is: `0 .7 0`, Return is: 1 where the value of g in line 2 has not changed to 0.700000 and the return value of the sscanf function is 1, not 3. A possible solution might be to insert: if (nch == '.') { cur = 0; goto HANDLE_DECIMALS; } directly after /* get first digit. */ in line 265 of original scanf.h and: HANDLE_DECIMALS: directly after /* handle decimals */ in line 276 of original scanf.h. Probably not the best solution, but it works. By the way; How do I manage to compile *only* msvcrt.dll.so? I tried make in the msvcrt-dir, but just the seperate object files were gene- rated, not the whole library... so I had to compile the complete wine-suit in order to get my patched msvcrt.dll.so ;} Please, drop me a line, if there is a more simple way to get a single library. Thanks. With best regards, Elmar Knittel, elmkni(a)freenet.de -- Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.