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 | unsigned int data_size; | 326 | unsigned int data_size; |
| 327 | int ret; | 327 | int ret; |
| 328 | 328 | ||
| 329 | bytestream2_init(gbc, avpkt->data, avpkt->size); | 329 | if (avpkt->size < 4 + 4) { |
| 330 | if (bytestream2_get_bytes_left(gbc) < 4 + 4) { | ||
| 331 | av_log(avctx, AV_LOG_ERROR, "Frame is too small (%d).\n", avpkt->size); | 330 | av_log(avctx, AV_LOG_ERROR, "Frame is too small (%d).\n", avpkt->size); |
| 332 | return AVERROR_INVALIDDATA; | 331 | return AVERROR_INVALIDDATA; |
| 333 | } | 332 | } |
| 333 | bytestream2_init(gbc, avpkt->data, avpkt->size); | ||
| 334 | 334 | ||
| 335 | uint32_t info_tag = bytestream2_peek_le32u(gbc); | 335 | uint32_t info_tag = bytestream2_peek_le32u(gbc); |
| 336 | if (info_tag == MKTAG('I', 'N', 'F', 'O')) { | 336 | if (info_tag == MKTAG('I', 'N', 'F', 'O')) { |