You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2021/05/21 16:04:44 UTC

[GitHub] [trafficserver] bneradt commented on a change in pull request #7868: Fixed ASAN issues with MMH test

bneradt commented on a change in pull request #7868:
URL: https://github.com/apache/trafficserver/pull/7868#discussion_r637038272



##########
File path: src/tscore/unit_tests/test_MMH.cc
##########
@@ -83,15 +83,18 @@ TEST_CASE("MMH", "[libts][MMH]")
       printf("********** collision %d\n", xy);
   }
 
-  unsigned char *s  = (unsigned char *)MMH_x;
-  int l             = sizeof(MMH_x);
-  unsigned char *s1 = (unsigned char *)ats_malloc(l + 3);
+  unsigned char *s       = (unsigned char *)MMH_x;
+  int l                  = sizeof(MMH_x);
+  unsigned char *s1      = (unsigned char *)ats_malloc(l + 4);

Review comment:
       Makes sense. What do you think of using `sizeof(int32_t)` instead of `4`? It would make the intention more explicit.
   
   `unsigned char *s1      = (unsigned char *)ats_malloc(l + sizeof(int32_t));`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org