mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
lavfi/showinfo: check plane count before dereferencing.
This commit is contained in:
parent
2fb240ddb6
commit
9138f6da4a
@ -50,7 +50,7 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
|
|||||||
uint32_t plane_checksum[4] = {0}, checksum = 0;
|
uint32_t plane_checksum[4] = {0}, checksum = 0;
|
||||||
int i, plane, vsub = desc->log2_chroma_h;
|
int i, plane, vsub = desc->log2_chroma_h;
|
||||||
|
|
||||||
for (plane = 0; frame->data[plane] && plane < 4; plane++) {
|
for (plane = 0; plane < 4 && frame->data[plane]; plane++) {
|
||||||
int64_t linesize = av_image_get_linesize(frame->format, frame->video->w, plane);
|
int64_t linesize = av_image_get_linesize(frame->format, frame->video->w, plane);
|
||||||
uint8_t *data = frame->data[plane];
|
uint8_t *data = frame->data[plane];
|
||||||
int h = plane == 1 || plane == 2 ? inlink->h >> vsub : inlink->h;
|
int h = plane == 1 || plane == 2 ? inlink->h >> vsub : inlink->h;
|
||||||
@ -80,7 +80,7 @@ static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *frame)
|
|||||||
av_get_picture_type_char(frame->video->pict_type),
|
av_get_picture_type_char(frame->video->pict_type),
|
||||||
checksum, plane_checksum[0]);
|
checksum, plane_checksum[0]);
|
||||||
|
|
||||||
for (plane = 1; frame->data[plane] && plane < 4; plane++)
|
for (plane = 1; plane < 4 && frame->data[plane]; plane++)
|
||||||
av_log(ctx, AV_LOG_INFO, " %08X", plane_checksum[plane]);
|
av_log(ctx, AV_LOG_INFO, " %08X", plane_checksum[plane]);
|
||||||
av_log(ctx, AV_LOG_INFO, "]\n");
|
av_log(ctx, AV_LOG_INFO, "]\n");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user