From bee8b925e052bbe7eddf66830c5a543a097481a1 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 2 Jul 2024 14:30:44 +0200 Subject: [PATCH] vcomp/cineform: fixed crashing RGB Together with the previous revert commit fixes CID 464437. In addition to incorrect change to unsigned, also parenthesis around (height - 1) were missing. --- src/video_compress/cineform.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/video_compress/cineform.cpp b/src/video_compress/cineform.cpp index c5fecbeea..739e3cf42 100644 --- a/src/video_compress/cineform.cpp +++ b/src/video_compress/cineform.cpp @@ -337,10 +337,11 @@ static video_frame *get_copy(struct state_video_compress_cineform *s, video_fram auto *dst = (unsigned char *) ret->tiles[0].data; int dst_sign = 1; if (s->precompress_desc.color_spec == RGB) { // upside down - dst += static_cast(dst_linesize) * frame->tiles[0].height - 1; + dst += static_cast(dst_linesize) * + (frame->tiles[0].height - 1); dst_sign = -1; } - for (long int i = 0; i < frame->tiles[0].height; ++i) { + for (long int i = 0; i < (long int) frame->tiles[0].height; ++i) { s->dec(dst + dst_sign * i * dst_linesize, (unsigned char *) frame->tiles[0].data + i * src_linesize, dst_linesize, 16, 8, 0); }