apps/speed.c: address asan failure with small -bytes and large -misalign.
authorAndy Polyakov <appro@openssl.org>
Mon, 21 May 2018 12:26:54 +0000 (14:26 +0200)
committerAndy Polyakov <appro@openssl.org>
Wed, 30 May 2018 16:26:51 +0000 (18:26 +0200)
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6311)

apps/speed.c

index 3af6971a1a982b6bab774de38a7fe7fdbc5f1169..768e3a1ad3f88e436f0023af2e5cedb29ecd1114 100644 (file)
@@ -1690,7 +1690,10 @@ int speed_main(int argc, char **argv)
             }
         }
 
-        buflen = lengths[size_num - 1] + MAX_MISALIGNMENT + 1;
+        buflen = lengths[size_num - 1];
+        if (buflen < 36)    /* size of random vector in RSA bencmark */
+            buflen = 36;
+        buflen += MAX_MISALIGNMENT + 1;
         loopargs[i].buf_malloc = app_malloc(buflen, "input buffer");
         loopargs[i].buf2_malloc = app_malloc(buflen, "input buffer");
         memset(loopargs[i].buf_malloc, 0, buflen);