[FFmpeg-devel] [PATCH] sanm: fix undefined behaviour on big-endian.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Aug 11 11:08:01 CEST 2013


A variable with post-increment may only appear
once in a statement.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
---
 libavcodec/sanm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c
index e6e866e..d1ef0ce 100644
--- a/libavcodec/sanm.c
+++ b/libavcodec/sanm.c
@@ -1044,8 +1044,10 @@ static int decode_5(SANMVideoContext *ctx)
 #if HAVE_BIGENDIAN
     npixels = ctx->npixels;
     frm = ctx->frm0;
-    while (npixels--)
-        *frm++ = av_bswap16(*frm);
+    while (npixels--) {
+        *frm = av_bswap16(*frm);
+        frm++;
+    }
 #endif
 
     return 0;
-- 
1.8.4.rc1



More information about the ffmpeg-devel mailing list