Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit af96b9b

Browse files
committed
Bug 1561256 - Disable CRC checks in ogg framing for FUZZING. r=drno
Depends on D35775 Differential Revision: https://phabricator.services.mozilla.com/D35776 --HG-- extra : moz-landing-system : lando
1 parent 132dcaf commit af96b9b

3 files changed

Lines changed: 56 additions & 1 deletion

File tree

media/libogg/ogg-fuzzing.patch

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# HG changeset patch
2+
# User Christian Holler <choller@mozilla.com>
3+
# Date 1561460220 -7200
4+
# Tue Jun 25 12:57:00 2019 +0200
5+
# Node ID 063a710e0bd70855ed5342ce109d42ea3b1a4abf
6+
# Parent 2388cab0a545d744bd109fa3a7af3b22a3dc4ced
7+
Bug 1561256 - Disable CRC checks in ogg framing for FUZZING. r=drno
8+
9+
diff --git a/media/libogg/src/ogg_framing.c b/media/libogg/src/ogg_framing.c
10+
--- a/media/libogg/src/ogg_framing.c
11+
+++ b/media/libogg/src/ogg_framing.c
12+
@@ -287,34 +287,38 @@ static int _os_lacing_expand(ogg_stream_
13+
}
14+
15+
/* checksum the page */
16+
/* Direct table CRC; note that this will be faster in the future if we
17+
perform the checksum simultaneously with other copies */
18+
19+
void ogg_page_checksum_set(ogg_page *og){
20+
if(og){
21+
+#ifndef FUZZING
22+
ogg_uint32_t crc_reg=0;
23+
int i;
24+
+#endif
25+
26+
/* safety; needed for API behavior, but not framing code */
27+
og->header[22]=0;
28+
og->header[23]=0;
29+
og->header[24]=0;
30+
og->header[25]=0;
31+
32+
+#ifndef FUZZING
33+
for(i=0;i<og->header_len;i++)
34+
crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]];
35+
for(i=0;i<og->body_len;i++)
36+
crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->body[i]];
37+
38+
og->header[22]=(unsigned char)(crc_reg&0xff);
39+
og->header[23]=(unsigned char)((crc_reg>>8)&0xff);
40+
og->header[24]=(unsigned char)((crc_reg>>16)&0xff);
41+
og->header[25]=(unsigned char)((crc_reg>>24)&0xff);
42+
+#endif
43+
}
44+
}
45+
46+
/* submit data to the internal buffer of the framing engine */
47+
int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, int count,
48+
long e_o_s, ogg_int64_t granulepos){
49+
50+
long bytes = 0, lacing_vals;

media/libogg/src/ogg_framing.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,18 @@ static int _os_lacing_expand(ogg_stream_state *os,long needed){
292292

293293
void ogg_page_checksum_set(ogg_page *og){
294294
if(og){
295+
#ifndef FUZZING
295296
ogg_uint32_t crc_reg=0;
296297
int i;
298+
#endif
297299

298300
/* safety; needed for API behavior, but not framing code */
299301
og->header[22]=0;
300302
og->header[23]=0;
301303
og->header[24]=0;
302304
og->header[25]=0;
303305

306+
#ifndef FUZZING
304307
for(i=0;i<og->header_len;i++)
305308
crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]];
306309
for(i=0;i<og->body_len;i++)
@@ -310,6 +313,7 @@ void ogg_page_checksum_set(ogg_page *og){
310313
og->header[23]=(unsigned char)((crc_reg>>8)&0xff);
311314
og->header[24]=(unsigned char)((crc_reg>>16)&0xff);
312315
og->header[25]=(unsigned char)((crc_reg>>24)&0xff);
316+
#endif
313317
}
314318
}
315319

media/libogg/update.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ patch -p0 < solaris-types.patch
1515
# memory-reporting.patch adds ogg_alloc.c, make sure it doesn't exist to avoid
1616
# unpleasantries.
1717
rm -f ./src/ogg_alloc.c
18-
patch -p0 < memory-reporting.patch
18+
patch -p0 < memory-reporting.patch
19+
patch -p0 < ogg-fuzzing.patch

0 commit comments

Comments
 (0)