Bug 1561256 - Disable CRC checks in ogg framing for FUZZING. r=drno
authorChristian Holler <choller@mozilla.com>
Tue, 02 Jul 2019 02:23:30 +0000
changeset 482922 e2965eee48fe016a62e85d16e4be3f841fc780f9
parent 482921 eb06624e60a07a85ad1981db4b93aae6c2d6d0d3
child 482923 5fa9c790f64b20fa1986c4bc7ea5dba8ca5e0042
push id113699
push userrgurzau@mozilla.com
push dateWed, 17 Jul 2019 03:57:10 +0000
treeherdermozilla-inbound@8fd4efa75b55 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno
bugs1561256
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1561256 - Disable CRC checks in ogg framing for FUZZING. r=drno Depends on D35775 Differential Revision: https://phabricator.services.mozilla.com/D35776
media/libogg/ogg-fuzzing.patch
media/libogg/src/ogg_framing.c
media/libogg/update.sh
new file mode 100644
--- /dev/null
+++ b/media/libogg/ogg-fuzzing.patch
@@ -0,0 +1,50 @@
+# HG changeset patch
+# User Christian Holler <choller@mozilla.com>
+# Date 1561460220 -7200
+#      Tue Jun 25 12:57:00 2019 +0200
+# Node ID 063a710e0bd70855ed5342ce109d42ea3b1a4abf
+# Parent  2388cab0a545d744bd109fa3a7af3b22a3dc4ced
+Bug 1561256 - Disable CRC checks in ogg framing for FUZZING. r=drno
+
+diff --git a/media/libogg/src/ogg_framing.c b/media/libogg/src/ogg_framing.c
+--- a/media/libogg/src/ogg_framing.c
++++ b/media/libogg/src/ogg_framing.c
+@@ -287,34 +287,38 @@ static int _os_lacing_expand(ogg_stream_
+ }
+ 
+ /* checksum the page */
+ /* Direct table CRC; note that this will be faster in the future if we
+    perform the checksum simultaneously with other copies */
+ 
+ void ogg_page_checksum_set(ogg_page *og){
+   if(og){
++#ifndef FUZZING
+     ogg_uint32_t crc_reg=0;
+     int i;
++#endif
+ 
+     /* safety; needed for API behavior, but not framing code */
+     og->header[22]=0;
+     og->header[23]=0;
+     og->header[24]=0;
+     og->header[25]=0;
+ 
++#ifndef FUZZING
+     for(i=0;i<og->header_len;i++)
+       crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]];
+     for(i=0;i<og->body_len;i++)
+       crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->body[i]];
+ 
+     og->header[22]=(unsigned char)(crc_reg&0xff);
+     og->header[23]=(unsigned char)((crc_reg>>8)&0xff);
+     og->header[24]=(unsigned char)((crc_reg>>16)&0xff);
+     og->header[25]=(unsigned char)((crc_reg>>24)&0xff);
++#endif
+   }
+ }
+ 
+ /* submit data to the internal buffer of the framing engine */
+ int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, int count,
+                        long e_o_s, ogg_int64_t granulepos){
+ 
+   long bytes = 0, lacing_vals;
--- a/media/libogg/src/ogg_framing.c
+++ b/media/libogg/src/ogg_framing.c
@@ -287,34 +287,38 @@ static int _os_lacing_expand(ogg_stream_
 }
 
 /* checksum the page */
 /* Direct table CRC; note that this will be faster in the future if we
    perform the checksum simultaneously with other copies */
 
 void ogg_page_checksum_set(ogg_page *og){
   if(og){
+#ifndef FUZZING
     ogg_uint32_t crc_reg=0;
     int i;
+#endif
 
     /* safety; needed for API behavior, but not framing code */
     og->header[22]=0;
     og->header[23]=0;
     og->header[24]=0;
     og->header[25]=0;
 
+#ifndef FUZZING
     for(i=0;i<og->header_len;i++)
       crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]];
     for(i=0;i<og->body_len;i++)
       crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->body[i]];
 
     og->header[22]=(unsigned char)(crc_reg&0xff);
     og->header[23]=(unsigned char)((crc_reg>>8)&0xff);
     og->header[24]=(unsigned char)((crc_reg>>16)&0xff);
     og->header[25]=(unsigned char)((crc_reg>>24)&0xff);
+#endif
   }
 }
 
 /* submit data to the internal buffer of the framing engine */
 int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, int count,
                        long e_o_s, ogg_int64_t granulepos){
 
   long bytes = 0, lacing_vals;
--- a/media/libogg/update.sh
+++ b/media/libogg/update.sh
@@ -10,9 +10,10 @@ cp $1/COPYING ./COPYING
 cp $1/README ./README
 cp $1/src/bitwise.c ./src/ogg_bitwise.c
 cp $1/src/framing.c ./src/ogg_framing.c
 cp $1/AUTHORS ./AUTHORS
 patch -p0 < solaris-types.patch
 # memory-reporting.patch adds ogg_alloc.c, make sure it doesn't exist to avoid
 # unpleasantries.
 rm -f ./src/ogg_alloc.c
-patch -p0 < memory-reporting.patch
\ No newline at end of file
+patch -p0 < memory-reporting.patch
+patch -p0 < ogg-fuzzing.patch