[Sugar-devel] [solved] Compiler warnings building olpcsound

Jigish Gohil cyberorg at opensuse.org
Wed Apr 29 01:10:37 EDT 2009


On Mon, Apr 27, 2009 at 5:05 PM, Jigish Gohil <cyberorg at opensuse.org> wrote:
> On Mon, Apr 27, 2009 at 4:58 PM, Aleksey Lim <alsroot at member.fsf.org> wrote:
>
>>>
>>> I: Statement might be overflowing a buffer in strncat. Common mistake:
>>> BAD: strncat(buffer,charptr,sizeof(buffer)) is wrong, it takes the
>>> left over size as 3rd argument
>>> GOOD: strncat(buffer,charptr,sizeof(buffer)-strlen(buffer)-1)
>>> E: olpcsound bufferoverflowstrncat OOps/dumpf.c:178, 181, 187, 190
>>>
>>> I: Program causes undefined operation
>>> (likely same variable used twiceand post/pre incremented in the same
>>> expression).
>>> e.g. x = x++; Split it in two operations.
>>> E: olpcsound sequence-point Opcodes/gab/sliderTable.c:396, 420, 444, 467
>>
>> could you post scons cmdline
>>
> Full build log:
>
> http://pastebin.com/f2b133522
>
> Changing the scons commandline shouldn't matter, oBS will not publish
> till the errors are fixed.
>
Hi

Just following up on the issue, Alsroot applied the attached patch to
get it going.

Cheers

-J

--- Csound5.10.1/OOps/dumpf.c.orig	2008-12-04 14:55:04.000000000 +0000
+++ Csound5.10.1/OOps/dumpf.c	2009-04-27 17:19:55.000000000 +0000
@@ -175,19 +175,19 @@
       outbuf[0] = '\0';
       while (--nk) {
         sprintf(buf1, "%ld\t", (long) *kp++);
-        strncat(outbuf, buf1, 256);
+        strncat(outbuf, buf1, sizeof(buf1)-strlen(buf1)-1);
       }
       sprintf(buf1, "%ld\n", (long) *kp);
-      strncat(outbuf, buf1, 256);
+      strncat(outbuf, buf1, sizeof(buf1)-strlen(buf1)-1);
       len = strlen(outbuf);
       break;
     case 8: *outbuf = '\0';
       while (--nk) {
         sprintf(buf1, "%6.4f\t", *kp++);
-        strncat(outbuf, buf1, 256);
+        strncat(outbuf, buf1, sizeof(buf1)-strlen(buf1)-1);
       }
       sprintf(buf1, "%6.4f\n", *kp);
-      strncat(outbuf, buf1, 256);
+      strncat(outbuf, buf1, sizeof(buf1)-strlen(buf1)-1);
       len = strlen(outbuf);
       break;
     default: csound->Die(csound, Str("unknown kdump format"));
--- Csound5.10.1/Opcodes/gab/sliderTable.c.orig	2008-01-03
13:05:53.000000000 +0000
+++ Csound5.10.1/Opcodes/gab/sliderTable.c	2009-04-27 17:27:44.000000000 +0000
@@ -364,7 +364,7 @@
             break;
          \
         }
          \
         *outTable++ =
          \
-            *yt1++ = *c1++ * value + *c2++ * *yt1; /* filters the
output */     \
+            *yt1 = *c1++ * value + *c2++ * *yt1; /* filters the
output */       \

          \
         min++; max++; j++; ftp++;
          \
     }
          \


More information about the Sugar-devel mailing list