summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2014-12-17 19:02:26 +1100
committerJessica Wagantall <jwagantall@cyngn.com>2016-09-12 13:59:10 -0700
commitff886db634f53d0b57126ebc950f12db31a9be98 (patch)
tree0fca9dda1b27f50b1f8c97616b2edde71841c0fe
parent13879f906673f968bab23601937dc08cc27c8ce9 (diff)
downloadandroid_external_flac-cm-12.1.tar.gz
android_external_flac-cm-12.1.tar.bz2
android_external_flac-cm-12.1.zip
src/libFLAC/stream_decoder.c : Fix NULL de-reference.cm-12.1
NULL de-reference can really only happen on a malformed file. Found using afl (http://lcamtuf.coredump.cx/afl/). CYNGNOS-3235 Bug: 27211885 Change-Id: Iad7ced634d417df475050c8f379e0e95ec36b115 (cherry picked from commit 83a817d2002b2b439ed85c002b18666b4dcb6cfd)
-rw-r--r--libFLAC/stream_decoder.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libFLAC/stream_decoder.c b/libFLAC/stream_decoder.c
index d3ff9ee..9e27667 100644
--- a/libFLAC/stream_decoder.c
+++ b/libFLAC/stream_decoder.c
@@ -1755,8 +1755,10 @@ FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__Stre
}
else
length -= 4;
- if (!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->comments[i].length))
+ if (!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->comments[i].length)) {
+ obj->num_comments = i;
return false; /* read_callback_ sets the state for us */
+ }
if (obj->comments[i].length > 0) {
if (length < obj->comments[i].length) {
obj->num_comments = i;