src/libFLAC/stream_decoder.c : Fix NULL de-reference.

NULL de-reference can really only happen on a malformed file.
Found using afl (http://lcamtuf.coredump.cx/afl/).
This commit is contained in:
Erik de Castro Lopo
2014-12-17 19:02:26 +11:00
parent 775eb934f7
commit 875be0ada5

View File

@@ -1753,8 +1753,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;