From 6521d685eef0ebff3790bbb0beb1f6d7f90b9e8d Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Sat, 14 Oct 2023 05:13:31 +0000 Subject: [PATCH] Bug 1857843 - Prepare local patches for libogg v1.3.5. r=media-playback-reviewers,padenot * Add new file crctable.h. * Define new USIZE64 type. * Remove ogg-fuzzing.patch. This local patch was added in bug 1561256 to disable CRC checking when fuzzing libogg. This patch is no longer necessary because libogg added a DISABLE_CRC flag in v1.3.4. Differential Revision: https://phabricator.services.mozilla.com/D190526 --- media/libogg/moz.build | 3 ++ media/libogg/moz.yaml | 9 +++++- media/libogg/ogg-fuzzing.patch | 50 ---------------------------------- 3 files changed, 11 insertions(+), 51 deletions(-) delete mode 100644 media/libogg/ogg-fuzzing.patch diff --git a/media/libogg/moz.build b/media/libogg/moz.build index f980b820cbc3..7900f8689281 100644 --- a/media/libogg/moz.build +++ b/media/libogg/moz.build @@ -23,3 +23,6 @@ NoVisibilityFlags() # Add libFuzzer configuration directives include('/tools/fuzzing/libfuzzer-config.mozbuild') + +if CONFIG['FUZZING']: + DEFINES['DISABLE_CRC'] = 1 diff --git a/media/libogg/moz.yaml b/media/libogg/moz.yaml index 68c58bd9bdab..da68acfedaf7 100644 --- a/media/libogg/moz.yaml +++ b/media/libogg/moz.yaml @@ -33,6 +33,7 @@ vendoring: - "include/ogg/ogg.h" - "include/ogg/os_types.h" - "src/bitwise.c" + - "src/crctable.h" - "src/framing.c" - AUTHORS - CHANGES @@ -46,6 +47,9 @@ vendoring: - action: move-file from: '{vendor_dir}/src/bitwise.c' to: '{vendor_dir}/src/ogg_bitwise.c' + - action: move-file + from: '{vendor_dir}/src/crctable.h' + to: '{vendor_dir}/src/crctable.h' - action: move-file from: '{vendor_dir}/src/framing.c' to: '{vendor_dir}/src/ogg_framing.c' @@ -83,6 +87,10 @@ vendoring: pattern: '@SIZE64@' with: 'int64_t' file: '{vendor_dir}/include/ogg/config_types.h.in' + - action: replace-in-file + pattern: '@USIZE64@' + with: 'uint64_t' + file: '{vendor_dir}/include/ogg/config_types.h.in' - action: move-file from: '{vendor_dir}/include/ogg/config_types.h.in' to: '{vendor_dir}/include/ogg/config_types.h' @@ -90,4 +98,3 @@ vendoring: patches: - solaris-types.patch - memory-reporting.patch - - ogg-fuzzing.patch diff --git a/media/libogg/ogg-fuzzing.patch b/media/libogg/ogg-fuzzing.patch deleted file mode 100644 index e4afbbeb15eb..000000000000 --- a/media/libogg/ogg-fuzzing.patch +++ /dev/null @@ -1,50 +0,0 @@ -# HG changeset patch -# User Christian Holler -# 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/src/ogg_framing.c b/src/ogg_framing.c ---- a/src/ogg_framing.c -+++ b/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;iheader_len;i++) - crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^og->header[i]]; - for(i=0;ibody_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;