1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

tools/enc_recon_frame_test: Assert that av_image_get_linesize() succeeds

Helps: CID1524598 Improper use of negative value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b6fa2ed77e57e82f3155b83ca4f4b3be8da5ff5c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-05-21 02:51:08 +02:00
parent 1ef18d0223
commit 87f805613c
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -28,6 +28,7 @@
#include "decode_simple.h"
#include "libavutil/adler32.h"
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/error.h"
#include "libavutil/frame.h"
@ -88,6 +89,8 @@ static int frame_hash(FrameChecksum **pc, size_t *nb_c, int64_t ts,
int linesize = av_image_get_linesize(frame->format, frame->width, p);
uint32_t checksum = 0;
av_assert0(linesize >= 0);
for (int j = 0; j < frame->height >> shift_v[p]; j++) {
checksum = av_adler32_update(checksum, data, linesize);
data += frame->linesize[p];