[FFmpeg-devel,1/3] avcodec/snowenc: Fix 2 undefined shifts

Submitted by Michael Niedermayer on Oct. 14, 2019, 11:48 p.m.

Details

Message ID 20191014234840.5978-1-michael@niedermayer.cc
State Accepted
Commit 8802e329c8317ca5ceb929df48a23eb0f9e852b2
Headers show

Commit Message

Michael Niedermayer Oct. 14, 2019, 11:48 p.m.
Fixes: Ticket7990

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/snowenc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer Nov. 9, 2019, 12:48 p.m.
On Tue, Oct 15, 2019 at 01:48:38AM +0200, Michael Niedermayer wrote:
> Fixes: Ticket7990
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/snowenc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply patchset

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index df1729a083..4166ce4e1d 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -312,7 +312,7 @@  static int encode_q_branch(SnowContext *s, int level, int x, int y){
     if(P_LEFT[1]     > (c->ymax<<shift)) P_LEFT[1]    = (c->ymax<<shift);
     if(P_TOP[0]      > (c->xmax<<shift)) P_TOP[0]     = (c->xmax<<shift);
     if(P_TOP[1]      > (c->ymax<<shift)) P_TOP[1]     = (c->ymax<<shift);
-    if(P_TOPRIGHT[0] < (c->xmin<<shift)) P_TOPRIGHT[0]= (c->xmin<<shift);
+    if(P_TOPRIGHT[0] < (c->xmin * (1<<shift))) P_TOPRIGHT[0]= (c->xmin * (1<<shift));
     if(P_TOPRIGHT[0] > (c->xmax<<shift)) P_TOPRIGHT[0]= (c->xmax<<shift); //due to pmx no clip
     if(P_TOPRIGHT[1] > (c->ymax<<shift)) P_TOPRIGHT[1]= (c->ymax<<shift);
 
@@ -1774,7 +1774,7 @@  FF_ENABLE_DEPRECATION_WARNINGS
             }else{
                 for(y=0; y<h; y++){
                     for(x=0; x<w; x++){
-                        s->spatial_dwt_buffer[y*w + x]=s->spatial_idwt_buffer[y*w + x]<<ENCODER_EXTRA_BITS;
+                        s->spatial_dwt_buffer[y*w + x]= s->spatial_idwt_buffer[y*w + x] * (1 << ENCODER_EXTRA_BITS);
                     }
                 }
             }