summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Matthews <tmatth@videolan.org>2017-09-24 14:18:17 +0200
committerTristan Matthews <tmatth@videolan.org>2017-11-07 18:53:17 -0500
commit862163e51f87fa5bf57b437dd502052da597c723 (patch)
treeceb37c3f97c52d3445f077f1479781ef31a1611f
parentc1daa80c20245c308f26add56991e36fd8954933 (diff)
downloadogg-git-862163e51f87fa5bf57b437dd502052da597c723.tar.gz
configure: add --disable-crc option
Useful for fuzzing
-rw-r--r--configure.ac11
-rw-r--r--src/framing.c14
2 files changed, 25 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 33c88ab..588d2f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -150,6 +150,17 @@ if test -z "$SIZE64"; then
AC_MSG_WARN(No 64 bit type found on this platform!)
fi
+AC_ARG_ENABLE([crc],
+ [AS_HELP_STRING([--disable-crc],
+ [Disable CRC in the demuxer)])],,
+ [enable_crc=yes])
+
+AM_CONDITIONAL([DISABLE_CRC], [test "$enable_crc" = "no"])
+
+AS_IF([test "$enable_crc" = "no"],[
+ AC_DEFINE([DISABLE_CRC], [1], [Do not build with CRC])
+])
+
dnl Checks for library functions.
AC_FUNC_MEMCMP
diff --git a/src/framing.c b/src/framing.c
index 79fc715..ee29651 100644
--- a/src/framing.c
+++ b/src/framing.c
@@ -20,6 +20,10 @@
********************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdlib.h>
#include <limits.h>
#include <string.h>
@@ -723,8 +727,10 @@ long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){
/* replace the computed checksum with the one actually read in */
memcpy(page+22,chksum,4);
+#ifndef DISABLE_CRC
/* Bad checksum. Lose sync */
goto sync_fail;
+#endif
}
}
@@ -1814,6 +1820,7 @@ int main(void){
test_pack(packets,headret,0,0,0);
}
+#ifndef DISABLE_CRC
{
/* test for the libogg 1.1.1 resync in large continuation bug
found by Josh Coalson) */
@@ -1823,6 +1830,9 @@ int main(void){
fprintf(stderr,"testing continuation resync in very large packets... ");
test_pack(packets,headret,100,2,3);
}
+#else
+ fprintf(stderr,"Skipping continuation resync test due to --disable-crc\n");
+#endif
{
/* term only page. why not? */
@@ -2084,6 +2094,7 @@ int main(void){
fprintf(stderr,"ok.\n");
}
+#ifndef DISABLE_CRC
/* Test recapture: page + garbage + page */
{
ogg_page og_de;
@@ -2125,6 +2136,9 @@ int main(void){
fprintf(stderr,"ok.\n");
}
+#else
+ fprintf(stderr,"Skipping recapture test due to --disable-crc\n");
+#endif
/* Free page data that was previously copied */
{