Enables the compiler to optimize the buf_size assert in bytestream2_init() away.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -326,11 +326,11 @@ static int hq_hqa_decode_frame(AVCodecContext *avctx, AVFrame *pic, · 325 unmodified lines | ||
| 326 | 326 | unsigned int data_size; |
| 327 | 327 | int ret; |
| 328 | 328 | |
| 329 | − bytestream2_init(gbc, avpkt->data, avpkt->size); | |
| 330 | − if (bytestream2_get_bytes_left(gbc) < 4 + 4) { | |
| 329 | + if (avpkt->size < 4 + 4) { | |
| 331 | 330 | av_log(avctx, AV_LOG_ERROR, "Frame is too small (%d).\n", avpkt->size); |
| 332 | 331 | return AVERROR_INVALIDDATA; |
| 333 | 332 | } |
| 333 | + bytestream2_init(gbc, avpkt->data, avpkt->size); | |
| 334 | 334 | |
| 335 | 335 | uint32_t info_tag = bytestream2_peek_le32u(gbc); |
| 336 | 336 | if (info_tag == MKTAG('I', 'N', 'F', 'O')) { |