Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-10-21 20:54:27 +0300
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-10-24 19:04:24 +0300
commit9a6cdd1ba3bd6fe592761dc7e9e6b5273495d048 (patch)
tree3d133e51306b2b477ca03c8dc7a08ecc8b14a775 /libavutil
parentf49375f28ff22af19d8a259bd21def5e876dc97b (diff)
avutil/integer: Fix undefined left shifts of negative numbers
Affected the integers FATE-test. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/integer.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/libavutil/integer.c b/libavutil/integer.c
index b709c6d487..3bc33dbca2 100644
--- a/libavutil/integer.c
+++ b/libavutil/integer.c
@@ -103,7 +103,7 @@ AVInteger av_shr_i(AVInteger a, int s){
for(i=0; i<AV_INTEGER_SIZE; i++){
unsigned int index= i + (s>>4);
unsigned int v=0;
- if(index+1<AV_INTEGER_SIZE) v = a.v[index+1]<<16;
+ if (index + 1 < AV_INTEGER_SIZE) v = a.v[index + 1] * (1U << 16);
if(index <AV_INTEGER_SIZE) v+= a.v[index ];
out.v[i]= v >> (s&15);
}
@@ -158,11 +158,9 @@ AVInteger av_int2i(int64_t a){
}
int64_t av_i2int(AVInteger a){
- int i;
- int64_t out=(int8_t)a.v[AV_INTEGER_SIZE-1];
+ uint64_t out = a.v[3];
- for(i= AV_INTEGER_SIZE-2; i>=0; i--){
+ for (int i = 2; i >= 0; i--)
out = (out<<16) + a.v[i];
- }
return out;
}