summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohann Koenig <johannkoenig@google.com>2019-12-17 19:41:23 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-12-17 19:41:23 +0000
commit8a30a2a4501a9e5c569d948d7f673dba69c9c944 (patch)
tree03edb3a824b95f804ebf119c8c5100ef4315d596
parentace8ab89b7fdd8d43716abc2f38f1f673b3a5ee7 (diff)
parent80e5666cdcb3cd62907e7bb1d3618bf6c5a259db (diff)
downloadlibvpx-8a30a2a4501a9e5c569d948d7f673dba69c9c944.tar
libvpx-8a30a2a4501a9e5c569d948d7f673dba69c9c944.tar.gz
libvpx-8a30a2a4501a9e5c569d948d7f673dba69c9c944.tar.bz2
libvpx-8a30a2a4501a9e5c569d948d7f673dba69c9c944.zip
Merge "vp8 boolreader: ignore invalid input"
-rw-r--r--vp8/decoder/dboolhuff.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/vp8/decoder/dboolhuff.c b/vp8/decoder/dboolhuff.c
index 9cf74bf85..4cfaef05c 100644
--- a/vp8/decoder/dboolhuff.c
+++ b/vp8/decoder/dboolhuff.c
@@ -15,7 +15,11 @@
int vp8dx_start_decode(BOOL_DECODER *br, const unsigned char *source,
unsigned int source_sz, vpx_decrypt_cb decrypt_cb,
void *decrypt_state) {
- br->user_buffer_end = source + source_sz;
+ // To simplify calling code this fuction can be called with |source| == null
+ // and |source_sz| == 0. This and vp8dx_bool_decoder_fill() are essentially
+ // no-ops in this case.
+ // Work around a ubsan warning with a ternary to avoid adding 0 to null.
+ br->user_buffer_end = source ? source + source_sz : source;
br->user_buffer = source;
br->value = 0;
br->count = -8;