From bugzilla-daemon at icculus.org Tue May 7 13:16:09 2013 From: bugzilla-daemon at icculus.org (bugzilla-daemon at icculus.org) Date: Tue, 07 May 2013 17:16:09 +0000 Subject: [quake3-bugzilla] [Bug 5935] New: QVM memset and memcpy return NULL Message-ID: https://bugzilla.icculus.org/show_bug.cgi?id=5935 Bug ID: 5935 Summary: QVM memset and memcpy return NULL Classification: Unclassified Product: ioquake3 Version: GIT MASTER Hardware: All OS: All Status: NEW Severity: trivial Priority: P3 Component: Misc Assignee: zachary at ioquake.org Reporter: ZTurtleMan at gmail.com QA Contact: quake3-bugzilla at icculus.org QVM memset and memcpy return NULL, but should return first argument (like strncpy). However, fixing this will cause mods that use the return to be incompatible with vanilla q3 and past ioq3 versions. strncpy was returning incorrect non-zero value in vanilla q3 and fixed in ioq3, so might be similar issue of mod depending on it not working on vanilla q3. Should they be fixed or left as is? Issue is in CL_CgameSystemCalls, CL_UISystemCalls, and SV_GameSystemCalls. -- You are receiving this mail because: You are the QA Contact for the bug. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bugzilla-daemon at icculus.org Tue May 7 13:21:58 2013 From: bugzilla-daemon at icculus.org (bugzilla-daemon at icculus.org) Date: Tue, 07 May 2013 17:21:58 +0000 Subject: [quake3-bugzilla] [Bug 5935] QVM memset and memcpy return NULL In-Reply-To: References: Message-ID: https://bugzilla.icculus.org/show_bug.cgi?id=5935 --- Comment #1 from Zack Middleton --- Created attachment 3348 --> https://bugzilla.icculus.org/attachment.cgi?id=3348&action=edit Fix QVM memset and memcpy return values -- You are receiving this mail because: You are the QA Contact for the bug. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bugzilla-daemon at icculus.org Tue May 28 10:24:38 2013 From: bugzilla-daemon at icculus.org (bugzilla-daemon at icculus.org) Date: Tue, 28 May 2013 14:24:38 +0000 Subject: [quake3-bugzilla] [Bug 5944] New: Com_sprintf not working properly Message-ID: https://bugzilla.icculus.org/show_bug.cgi?id=5944 Bug ID: 5944 Summary: Com_sprintf not working properly Classification: Unclassified Product: ioquake3 Version: GIT MASTER Hardware: PC OS: Linux Status: NEW Severity: major Priority: P3 Component: Misc Assignee: zachary at ioquake.org Reporter: signaljammed at gmail.com QA Contact: quake3-bugzilla at icculus.org In the following code, copy is built on itself one character at a time from original. This used to work in an older version of ioq3 from back in 2009, but now when I use this same method with the latest ioquake3 source code it does not build upon copy. Instead each time the Com_sprintf call is made what copy previously had is being overwritten by the *p char. It is almost like it is ignoring the %s format character in the call. char original[1024]; char copy[1024]; char *p; p = original; while (1) { // do some text parsing // end of line if (!*p) break; // All cases above fail so write out the char Com_sprintf(copy, sizeof(copy), "%s%c", copy, *p); p++; } So if the original text was something like "the fox ran over the hill" then copy would be the last character in the string 'l'. It should be an exact replica of original. -- You are receiving this mail because: You are the QA Contact for the bug. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bugzilla-daemon at icculus.org Thu May 30 18:04:12 2013 From: bugzilla-daemon at icculus.org (bugzilla-daemon at icculus.org) Date: Thu, 30 May 2013 22:04:12 +0000 Subject: [quake3-bugzilla] [Bug 5944] Com_sprintf not working properly In-Reply-To: References: Message-ID: https://bugzilla.icculus.org/show_bug.cgi?id=5944 --- Comment #1 from signaljammed at gmail.com --- This seems to be a problem with the call to Q_vsnprintf() within Com_sprintf() upon further troubleshooting, however I am unsure why vsnprintf isn't handling the formatting correctly as it used to. -- You are receiving this mail because: You are the QA Contact for the bug. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bugzilla-daemon at icculus.org Fri May 31 03:29:05 2013 From: bugzilla-daemon at icculus.org (bugzilla-daemon at icculus.org) Date: Fri, 31 May 2013 07:29:05 +0000 Subject: [quake3-bugzilla] [Bug 5944] Com_sprintf not working properly In-Reply-To: References: Message-ID: https://bugzilla.icculus.org/show_bug.cgi?id=5944 Simon McVittie changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smcv-ioquake3 at pseudorandom. | |co.uk --- Comment #2 from Simon McVittie --- Com_sprintf() is basically ISO C (v)snprintf(), which doesn't allow this usage: C99 and POSIX.1-2001 specify that the results are undefined if a call to sprintf(), snprintf(), vsprintf(), or vsnprintf() would cause copy? ing to take place between objects that overlap (e.g., if the target string array and one of the supplied input arguments refer to the same buffer). If you're writing native code (stuff that ends up in the engine, or cgame/qagame/ui compiled to native code) then Com_sprintf() is just a wrapper around (v)snprintf(). If you're writing bytecode (cgame.qvm, qagame.qvm, ui.qvm), the implementation used is in bg_lib.c. -- You are receiving this mail because: You are the QA Contact for the bug. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bugzilla-daemon at icculus.org Fri May 31 05:12:56 2013 From: bugzilla-daemon at icculus.org (bugzilla-daemon at icculus.org) Date: Fri, 31 May 2013 09:12:56 +0000 Subject: [quake3-bugzilla] [Bug 5944] Com_sprintf not working properly In-Reply-To: References: Message-ID: https://bugzilla.icculus.org/show_bug.cgi?id=5944 Ben Millwood changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla at benmachine.co.uk --- Comment #3 from Ben Millwood --- I don't think it's so terrible that we don't support this use case. After all, it nearly always makes no sense: consider Com_sprintf(copy, sizeof(copy), "%c%s", *p, copy); I can imagine that just filling out copy up to its size with copies of *p. -- You are receiving this mail because: You are the QA Contact for the bug. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bugzilla-daemon at icculus.org Fri May 31 11:31:12 2013 From: bugzilla-daemon at icculus.org (bugzilla-daemon at icculus.org) Date: Fri, 31 May 2013 15:31:12 +0000 Subject: [quake3-bugzilla] [Bug 5944] Com_sprintf not working properly In-Reply-To: References: Message-ID: https://bugzilla.icculus.org/show_bug.cgi?id=5944 --- Comment #4 from signaljammed at gmail.com --- Wow, this is really bad news to hear. I have written ALOT of code in my mod that utilizes this technique of building/parsing char strings. What options do I have going forward to accomplish this same use? What other methods are there to building strings like this? -- You are receiving this mail because: You are the QA Contact for the bug. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bugzilla-daemon at icculus.org Fri May 31 11:42:38 2013 From: bugzilla-daemon at icculus.org (bugzilla-daemon at icculus.org) Date: Fri, 31 May 2013 15:42:38 +0000 Subject: [quake3-bugzilla] [Bug 5944] Com_sprintf not working properly In-Reply-To: References: Message-ID: https://bugzilla.icculus.org/show_bug.cgi?id=5944 Tim Angus changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tim at ngus.net --- Comment #5 from Tim Angus --- Unless I'm misunderstanding, strcat? -- You are receiving this mail because: You are the QA Contact for the bug. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bugzilla-daemon at icculus.org Fri May 31 12:47:46 2013 From: bugzilla-daemon at icculus.org (bugzilla-daemon at icculus.org) Date: Fri, 31 May 2013 16:47:46 +0000 Subject: [quake3-bugzilla] [Bug 5944] Com_sprintf not working properly In-Reply-To: References: Message-ID: https://bugzilla.icculus.org/show_bug.cgi?id=5944 --- Comment #6 from signaljammed at gmail.com --- Yes, I suppose that would work but it will require breaking everything down into multiple steps where before it could all be done on one line. Take for instance, Com_sprintf(line, sizeof(line), "%s%2i ^1:^7 ", line, i); Now in order to accomplish the same thing with strcat I would have to create a new char to do the formatting and then call strcat to append it to line... Com_sprintf(buffer, sizeof(buffer), "%2i ^1:^7 ", i); strcat(line, buffer); Doable yes but just going to be a pain in the ass. :( -- You are receiving this mail because: You are the QA Contact for the bug. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bugzilla-daemon at icculus.org Fri May 31 13:04:20 2013 From: bugzilla-daemon at icculus.org (bugzilla-daemon at icculus.org) Date: Fri, 31 May 2013 17:04:20 +0000 Subject: [quake3-bugzilla] [Bug 5944] Com_sprintf not working properly In-Reply-To: References: Message-ID: https://bugzilla.icculus.org/show_bug.cgi?id=5944 --- Comment #7 from Tim Angus --- You could also do strcpy(buffer, va("%s", ...));. Same thing really. -- You are receiving this mail because: You are the QA Contact for the bug. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bugzilla-daemon at icculus.org Fri May 31 13:16:38 2013 From: bugzilla-daemon at icculus.org (bugzilla-daemon at icculus.org) Date: Fri, 31 May 2013 17:16:38 +0000 Subject: [quake3-bugzilla] [Bug 5944] Com_sprintf not working properly In-Reply-To: References: Message-ID: https://bugzilla.icculus.org/show_bug.cgi?id=5944 --- Comment #8 from signaljammed at gmail.com --- Thanks. I'll take a look at doing it that way. -- You are receiving this mail because: You are the QA Contact for the bug. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bugzilla-daemon at icculus.org Fri May 31 14:07:42 2013 From: bugzilla-daemon at icculus.org (bugzilla-daemon at icculus.org) Date: Fri, 31 May 2013 18:07:42 +0000 Subject: [quake3-bugzilla] [Bug 5944] Com_sprintf not working properly In-Reply-To: References: Message-ID: https://bugzilla.icculus.org/show_bug.cgi?id=5944 --- Comment #9 from Ben Millwood --- Another way is something along the lines of l = strlen(copy); Com_sprintf(©[l], sizeof(copy) - l, "%2i ^1:^7", ... ); Often you already know the length of copy (or can easily keep track of it), so you can skip the first step. -- You are receiving this mail because: You are the QA Contact for the bug. -------------- next part -------------- An HTML attachment was scrubbed... URL: