[FFmpeg-cvslog] sha: change loop condition to be tighter.

Michael Niedermayer git at videolan.org
Thu Oct 11 03:05:12 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Oct 11 02:42:18 2012 +0200| [4e4ae2f82caacd03fe936e5553c2e8f70ee109e9] | committer: Michael Niedermayer

sha: change loop condition to be tighter.

This makes no change to the way the code functions, but should make
it easier for static analyzers to see the valid range for i

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4e4ae2f82caacd03fe936e5553c2e8f70ee109e9
---

 libavutil/sha.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/sha.c b/libavutil/sha.c
index 7194d43..c5d13c1 100644
--- a/libavutil/sha.c
+++ b/libavutil/sha.c
@@ -210,7 +210,7 @@ static void sha256_transform(uint32_t *state, const uint8_t buffer[64])
         a = T1 + T2;
     }
 #else
-    for (i = 0; i < 16;) {
+    for (i = 0; i < 16 - 7;) {
         ROUND256_0_TO_15(a, b, c, d, e, f, g, h);
         ROUND256_0_TO_15(h, a, b, c, d, e, f, g);
         ROUND256_0_TO_15(g, h, a, b, c, d, e, f);
@@ -221,7 +221,7 @@ static void sha256_transform(uint32_t *state, const uint8_t buffer[64])
         ROUND256_0_TO_15(b, c, d, e, f, g, h, a);
     }
 
-    for (; i < 64;) {
+    for (; i < 64 - 7;) {
         ROUND256_16_TO_63(a, b, c, d, e, f, g, h);
         ROUND256_16_TO_63(h, a, b, c, d, e, f, g);
         ROUND256_16_TO_63(g, h, a, b, c, d, e, f);



More information about the ffmpeg-cvslog mailing list