diff mbox series

[FFmpeg-devel,v1] avfilter/vf_showinfo: fix the integer handling issues

Message ID 20200109010211.20852-1-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,v1] avfilter/vf_showinfo: fix the integer handling issues
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Limin Wang Jan. 9, 2020, 1:02 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Fixes CID 1457606 and 1457607
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavfilter/vf_showinfo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer Jan. 10, 2020, 4:32 p.m. UTC | #1
On Thu, Jan 09, 2020 at 09:02:11AM +0800, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Fixes CID 1457606 and 1457607
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavfilter/vf_showinfo.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 5fff123..79b79db 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -221,10 +221,10 @@  static void update_sample_stats_16(int be, const uint8_t *src, int len, int64_t
     for (i = 0; i < len / 2; i++) {
         if ((HAVE_BIGENDIAN && !be) || (!HAVE_BIGENDIAN && be)) {
             *sum += av_bswap16(src1[i]);
-            *sum2 += av_bswap16(src1[i]) * av_bswap16(src1[i]);
+            *sum2 += (uint32_t)av_bswap16(src1[i]) * (uint32_t)av_bswap16(src1[i]);
         } else {
             *sum += src1[i];
-            *sum2 += src1[i] * src1[i];
+            *sum2 += (uint32_t)src1[i] * (uint32_t)src1[i];
         }
     }
 }