aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClément Bœsch <ubitux@gmail.com>2012-07-02 19:31:35 +0200
committerClément Bœsch <ubitux@gmail.com>2012-07-02 21:02:15 +0200
commit7c84e7d33762a4bccc0002476a3b20e0b8f26fcc (patch)
tree30163a541ec3307e174568460f8b7fb66de4a52c
parent2278a3e5f7327fb2ba823fb10275b5a726adee6f (diff)
downloadffmpeg-7c84e7d33762a4bccc0002476a3b20e0b8f26fcc.tar.gz
mem: heap memory poisoning.
Enable it by default with FATE. limitation: not random, and not supported with realloc.
-rwxr-xr-xconfigure2
-rw-r--r--libavutil/mem.c8
-rwxr-xr-xtests/fate.sh1
3 files changed, 10 insertions, 1 deletions
diff --git a/configure b/configure
index a1346fac3f..cb8a04d2bb 100755
--- a/configure
+++ b/configure
@@ -286,6 +286,7 @@ Developer options (useful when working on FFmpeg itself):
--disable-stripping disable stripping of executables and shared libraries
--assert-level=level 0(default), 1 or 2, amount of assertion testing,
2 causes a slowdown at runtime.
+ --enable-memory-poisoning fill heap uninitialized allocated space with arbitrary data
--valgrind=VALGRIND run "make fate" tests through valgrind to detect memory
leaks and errors, using the specified valgrind binary.
Cannot be combined with --target-exec
@@ -1080,6 +1081,7 @@ CONFIG_LIST="
lsp
mdct
memalign_hack
+ memory_poisoning
mpegaudiodsp
network
nonfree
diff --git a/libavutil/mem.c b/libavutil/mem.c
index 385ace0702..8ec226b17a 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -125,8 +125,14 @@ void *av_malloc(size_t size)
#else
ptr = malloc(size);
#endif
- if(!ptr && !size)
+ if(!ptr && !size) {
+ size = 1;
ptr= av_malloc(1);
+ }
+#if CONFIG_MEMORY_POISONING
+ if (ptr)
+ memset(ptr, 0x2a, size);
+#endif
return ptr;
}
diff --git a/tests/fate.sh b/tests/fate.sh
index a7b15cd1b0..0bf10ab853 100755
--- a/tests/fate.sh
+++ b/tests/fate.sh
@@ -45,6 +45,7 @@ configure()(
--prefix="${inst}" \
--samples="${samples}" \
--enable-gpl \
+ --enable-memory-poisoning \
${arch:+--arch=$arch} \
${cpu:+--cpu="$cpu"} \
${cross_prefix:+--cross-prefix="$cross_prefix"} \