Fixes assertion failure
Fixes: 24ebfda03228b5cc1ef792608cfba458/signal_sigabrt_7ffff6ae7c37_6473_3fa8a111dbc752b1a7c411c5ab79aaa4.wma
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 67318187fbba382d887f9581dde48a50842f1bea)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
... | ... |
@@ -1271,6 +1271,11 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr, |
1271 | 1271 |
} |
1272 | 1272 |
} |
1273 | 1273 |
|
1274 |
+ if (remaining_bits(s, gb) < 0) { |
|
1275 |
+ av_log(avctx, AV_LOG_ERROR, "Overread %d\n", -remaining_bits(s, gb)); |
|
1276 |
+ s->packet_loss = 1; |
|
1277 |
+ } |
|
1278 |
+ |
|
1274 | 1279 |
if (s->packet_done && !s->packet_loss && |
1275 | 1280 |
remaining_bits(s, gb) > 0) { |
1276 | 1281 |
/* save the rest of the data so that it can be decoded |