[xiph-commits] r3222 - liboggz/trunk/src/liboggz

shans at svn.annodex.net shans at svn.annodex.net
Tue Sep 4 00:46:25 PDT 2007


Author: shans
Date: 2007-09-04 00:46:24 -0700 (Tue, 04 Sep 2007)
New Revision: 3222

Modified:
   liboggz/trunk/src/liboggz/oggz_auto.c
Log:
Don't let gp go below zero when counting backwards (vorbis)



Modified: liboggz/trunk/src/liboggz/oggz_auto.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz_auto.c	2007-09-04 06:59:29 UTC (rev 3221)
+++ liboggz/trunk/src/liboggz/oggz_auto.c	2007-09-04 07:46:24 UTC (rev 3222)
@@ -752,11 +752,14 @@
       (this_packet->packet[0] >> 1) & ((1 << info->log2_num_modes) - 1);
   int this_size = info->mode_sizes[mode] ? info->long_size : info->short_size;
   int next_size;
+  ogg_int64_t r;
 
   mode = (next_packet->packet[0] >> 1) & ((1 << info->log2_num_modes) - 1);
   next_size = info->mode_sizes[mode] ? info->long_size : info->short_size;
 
-  return next_packet_gp - ((this_size + next_size) / 4);
+  r = next_packet_gp - ((this_size + next_size) / 4);
+  if (r < 0) return 0L;
+  return r;
 
 }
 



More information about the commits mailing list