aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn van Beurden <mvanb1@gmail.com>2023-04-26 11:08:28 +0200
committerMartijn van Beurden <mvanb1@gmail.com>2023-05-11 09:01:44 +0200
commitc65ef58924938e2375c427d0cfca6931d278f95c (patch)
treedf5a066bc89f32cea52059b249794e83391ea302
parentc623f0f42c5fc8abb42ffddd2094cf095f4f7f57 (diff)
downloadflac-c65ef58924938e2375c427d0cfca6931d278f95c.tar.gz
Stop processing subframes when invalid data is found
This fixes https://github.com/xiph/flac/issues/580 The problem was that after encountering a problem in a first subframe, the state was changed from READ_FRAME to SEARCH_FOR_FRAME_SYNC, which meant a problem in the second subframe was interpreted as a read error instead of invalid data. With this patch, processing of subframes is stopped after setting SEARCH_FOR_FRAME_SYNC
-rw-r--r--src/libFLAC/stream_decoder.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c
index 400aef14..6c82cbd7 100644
--- a/src/libFLAC/stream_decoder.c
+++ b/src/libFLAC/stream_decoder.c
@@ -2095,6 +2095,8 @@ FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FL
else
return false;
}
+ if(decoder->protected_->state != FLAC__STREAM_DECODER_READ_FRAME)
+ break;
}
if(decoder->protected_->state != FLAC__STREAM_DECODER_END_OF_STREAM)