]> git.sesse.net Git - ffmpeg/commitdiff
avutil/camellia: make LR128() more robust
authorGiorgio Vazzana <mywing81@gmail.com>
Fri, 2 Jan 2015 15:49:12 +0000 (16:49 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 2 Jan 2015 20:23:50 +0000 (21:23 +0100)
Signed-off-by: Giorgio Vazzana <mywing81@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/camellia.c

index fcbf9702b75e0f42cdaab161cee4f1f8b696193b..2e719bee2df1f95821c1d0fc04c529b293e4bc2e 100644 (file)
@@ -126,14 +126,14 @@ static const uint8_t SBOX4[256] =
 
 const int av_camellia_size = sizeof(AVCAMELLIA);
 
-static void LR128(uint64_t* d, uint64_t *K, int x)
+static void LR128(uint64_t d[2], const uint64_t K[2], int x)
 {
     int i = 0;
     if (x >=64 && x < 128) {
         i = 1;
         x -= 64;
     }
-    if (!x || x == 128) {
+    if (x <= 0 || x >= 128) {
         d[0] = K[i];
         d[1] = K[!i];
         return;