[PATCH] Fix unsigned < 0 comparisons
From df3c43d9823fae253a63821ea6653472ede1c815 Mon Sep 17 00:00:00 2001 From: Martin Panter <vadmium à gmail·com> Date: Tue, 17 Sep 2013 09:10:16 +0000 Subject: [PATCH] Fix unsigned < 0 comparisons
* Previous tag size field is supposed to be unsigned (UI32 type), so cannot be negative * Extended timestamp field is apparently signed (SI32 value), so check for negative by testing high bit --- Unmangled patch: https://github.com/vadmium/rtmpdump/commit/df3c43d.patch rtmpdump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rtmpdump.c b/rtmpdump.c index 13741a7..186ce52 100644 --- a/rtmpdump.c +++ b/rtmpdump.c @@ -332,10 +332,10 @@ GetLastKeyframe(FILE * file, // output file [in] return RD_FAILED; } - if (prevTagSize < 0 || prevTagSize > size - 4 - 13) + if (prevTagSize > size - 4 - 13) { RTMP_Log(RTMP_LOGERROR, - "Last tag size must be greater/equal zero (prevTagSize=%d) and smaller then filesize, corrupt file!", + "Last tag size must be smaller than filesize (prevTagSize=%d), corrupt file!", prevTagSize); return RD_FAILED; } @@ -395,7 +395,7 @@ GetLastKeyframe(FILE * file, // output file [in] //{ //} - if (*dSeek < 0) + if (*dSeek & 0x80000000) { RTMP_Log(RTMP_LOGERROR, "Last keyframe timestamp is negative, aborting, your file is corrupt!"); -- 1.9.3
participants (1)
-
Martin Panter