Skip to content

Commit

Permalink
y4m output: make sure image widths are valid
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Oct 20, 2024
1 parent 09881e1 commit b56f7c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions heifio/encoder_y4m.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ bool Y4MEncoder::Encode(const struct heif_image_handle* handle,
int cw = heif_image_get_width(image, heif_channel_Cb);
int ch = heif_image_get_height(image, heif_channel_Cb);

if (yw < 0 || cw < 0) {
return false;
}

fprintf(fp, "YUV4MPEG2 W%d H%d F30:1\nFRAME\n", yw, yh);

for (int y = 0; y < yh; y++) {
Expand Down

0 comments on commit b56f7c1

Please sign in to comment.