I am getting this after all the tests were performed, network transfer of the report file was over and after the http server has responded (with some error-message) in Wine:
err:win:WIN_FindWndPtr window 0x10022 belongs to other process err:win:WIN_FindWndPtr window 0x10022 belongs to other process wine: Unhandled exception (thread 000b), starting debugger... fixme:console:SetConsoleCtrlHandler (0x4067a644,1) - no error checking or testing yet WineDbg starting on pid 0xa Unhandled exception: page fault on read access to 0xffe5024c in 32-bit code (0x40045cf2). In 32 bit mode. 0x40045cf2 pthread_mutex_lock in libpthread.so.0: movl 0xc(%edi),%eax Wine-dbg>bt Backtrace: =>1 0x40045cf2 pthread_mutex_lock+0x12 in libpthread.so.0 (0x40c0fe28) 2 0x42075bea free+0x9a in libc.so.6 (0x40c0fe48) 3 0x4065753a send_file+0x362(name=0x781e4a80) [send.c:217] in winetest (0x40c0fe78) 4 0x40656f2e .L256+0xde in winetest (0x40c0fe9c) 5 0x4065511c __wine_exe_main+0x11c in winetest (0x40c0ff2c) 6 0x403a101a start_process+0xf2(arg=0x0) [process.c:995] in kernel32 (0x40c0fff4) 7 0x4002a8cd wine_switch_to_stack+0x11 in libwine.so.1 (0x00000000)
And the error message in the message-box looks like this:
Can't submit logfile '/tmp/rescVOMCP'. Server response: <!DOCTYPE HTML PUBLIC"... ... <title>500 Internal Server Error</title> ... <p>The server encountered an internal error or misconfiguration and was unable to complete your request.</p> ... <address>Apache 2.0.40 Server at test.winehq.org Port 80</address> <body><html>
Back to the code. Excerpts from the programs/winetest/send.c:
unsigned char *buffer;
...
buffer = xmalloc (BUFLEN + 1);
...
if (ret) { buffer[total] = 0; str = strstr (buffer, "\r\n\r\n"); if (str) buffer = str + 4; report (R_ERROR, "Can't submit logfile '%s'. " "Server response: %s", name, buffer); } free (buffer);
Is it OK to try to free the modified "buffer" ptr? I thought we should preserve its value. We can use the "str" instead of the "buffer". I've tried such mod and it worked fine in my case:
--- wine/programs/winetest/send.c 6 Jul 2004 21:03:22 -0000 1.12 +++ wine/programs/winetest/send.c 18 Aug 2004 07:41:24 -0000 @@ -209,9 +209,9 @@ if (ret) { buffer[total] = 0; str = strstr (buffer, "\r\n\r\n"); - if (str) buffer = str + 4; + str = (str)?(str + 4):(buffer); report (R_ERROR, "Can't submit logfile '%s'. " - "Server response: %s", name, buffer); + "Server response: %s", name, str); } free (buffer); return ret;
Should I submit it to the wine-patches or I am wrong with it?
Is it OK to try to free the modified "buffer" ptr? I thought we should preserve its value.
Yes, you are right, that code is illegal. The wonderful thing is that it's more than half a year old, and went unnoticed this far! Probably because the WineHQ server never failed during that period. Amazing. I wonder what have happened to it now.
We can use the "str" instead of the "buffer". I've tried such mod and it worked fine in my case:
Yes, your patch is good. Still I recommend something more, as I can't see why buffer should be dynamic at all. Please check it in case I made another mistake:
Index: programs/winetest/send.c =================================================================== RCS file: /home/wine/wine/programs/winetest/send.c,v retrieving revision 1.12 diff -u -r1.12 send.c --- programs/winetest/send.c 6 Jul 2004 21:03:22 -0000 1.12 +++ programs/winetest/send.c 18 Aug 2004 11:26:02 -0000 @@ -107,7 +107,7 @@ SOCKET s; FILE *f; #define BUFLEN 8192 - unsigned char *buffer; + unsigned char buffer[BUFLEN+1]; size_t bytes_read, total, filesize; char *str; int ret; @@ -127,7 +127,6 @@ "Upload File\r\n" "--" SEP "--\r\n";
- buffer = xmalloc (BUFLEN + 1); s = open_http ("test.winehq.org"); if (s == INVALID_SOCKET) return 1;
@@ -209,17 +208,15 @@ if (ret) { buffer[total] = 0; str = strstr (buffer, "\r\n\r\n"); - if (str) buffer = str + 4; + str = str ? str+4 : buffer; report (R_ERROR, "Can't submit logfile '%s'. " - "Server response: %s", name, buffer); + "Server response: %s", name, str); } - free (buffer); return ret;
abort2: fclose (f); abort1: close_http (s); - free (buffer); return 1; }
Thanks for the good spotting, Feri.
On Wed, 18 Aug 2004, Ferenc Wagner wrote:
We can use the "str" instead of the "buffer". I've tried such mod and it worked fine in my case:
Yes, your patch is good. Still I recommend something more, as I can't see why buffer should be dynamic at all. Please check it in case I made another mistake:
Ok then. In this case "my" part of the patch can be omitted:
@@ -209,17 +208,15 @@ if (ret) { buffer[total] = 0; str = strstr (buffer, "\r\n\r\n");
if (str) buffer = str + 4;
str = str ? str+4 : buffer; report (R_ERROR, "Can't submit logfile '%s'. "
"Server response: %s", name, buffer);
}"Server response: %s", name, str);
..as "buffer" doesn't need to be preserved anymore. =)
On Wed, 18 Aug 2004, Saulius Krasuckas wrote:
On Wed, 18 Aug 2004, Ferenc Wagner wrote:
as I can't see why buffer should be dynamic at all. Please check it in case I made another mistake:
Ok then. In this case "my" part of the patch can be omitted: ..as "buffer" doesn't need to be preserved anymore. =)
Sorry for that nonsense. Maybe I got overheated today.