[vlc-devel] [PATCH] demux: avi: log height as signed value
Romain Vimont
rom1v at videolabs.io
Mon Oct 7 15:42:32 CEST 2019
The height may be "negative" (but still stored as unsigned) when the
lines are coded from bottom to top.
In that case, print 1920x-1080 instead of 1920x4294966216.
Ref #22915
---
modules/demux/avi/avi.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index db4659a1b3..2ad30d223f 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -635,10 +635,14 @@ static int Open( vlc_object_t * p_this )
tk->fmt.video.i_width;
}
- msg_Dbg( p_demux, "stream[%u] video(%4.4s) %"PRIu32"x%"PRIu32" %dbpp %ffps",
+ /* casting directly from unsigned to signed would be undefined when the MSB is 1 */
+ uint32_t unsigned_height = p_vids->p_bih->biHeight;
+ int sign = unsigned_height <= INT32_MAX ? 1 : -1;
+ int32_t height = sign * (int32_t) (sign * unsigned_height);
+ msg_Dbg( p_demux, "stream[%u] video(%4.4s) %"PRIu32"x%"PRId32" %dbpp %ffps",
i, (char*)&p_vids->p_bih->biCompression,
(uint32_t)p_vids->p_bih->biWidth,
- (uint32_t)p_vids->p_bih->biHeight,
+ height,
p_vids->p_bih->biBitCount,
(float)tk->i_rate/(float)tk->i_scale );
break;
--
2.23.0
More information about the vlc-devel
mailing list