[xiph-commits] r16285 - experimental/giles/rogg

giles at svn.xiph.org giles at svn.xiph.org
Tue Jul 14 15:27:10 PDT 2009


Author: giles
Date: 2009-07-14 15:27:10 -0700 (Tue, 14 Jul 2009)
New Revision: 16285

Modified:
   experimental/giles/rogg/rogg_serial.c
   experimental/giles/rogg/rogg_stats.c
Log:
Propagate parse_args fix from rogg_theora to the other scripts.


Modified: experimental/giles/rogg/rogg_serial.c
===================================================================
--- experimental/giles/rogg/rogg_serial.c	2009-07-14 22:17:29 UTC (rev 16284)
+++ experimental/giles/rogg/rogg_serial.c	2009-07-14 22:27:10 UTC (rev 16285)
@@ -83,7 +83,12 @@
       }
     }
     if (shift) {
-      memmove(&argv[arg],&argv[arg+shift],shift*sizeof(*argv));
+      int left = *argc - arg - shift;
+      if (left < 0) {
+	fprintf(stderr, "Interal error parsing argument '%s'.\n", argv[arg]);
+	exit(1);
+      }
+      memmove(&argv[arg], &argv[arg+shift], left*sizeof(*argv));      
       *argc -= shift;
     } else {
       arg++;

Modified: experimental/giles/rogg/rogg_stats.c
===================================================================
--- experimental/giles/rogg/rogg_stats.c	2009-07-14 22:17:29 UTC (rev 16284)
+++ experimental/giles/rogg/rogg_stats.c	2009-07-14 22:27:10 UTC (rev 16285)
@@ -81,7 +81,12 @@
       }
     }
     if (shift) {
-      memmove(&argv[arg],&argv[arg+shift],shift*sizeof(*argv));
+      int left = *argc - arg - shift;
+      if (left < 0) {
+	fprintf(stderr, "Interal error parsing argument '%s'.\n", argv[arg]);
+	exit(1);
+      }
+      memmove(&argv[arg], &argv[arg+shift], left*sizeof(*argv));
       *argc -= shift;
     } else {
       arg++;



More information about the commits mailing list