From 6c9e91e9c95ee0fde63d1b26ab1dacbcb58c1186 Mon Sep 17 00:00:00 2001 From: Tom Roeder Date: Thu, 28 Mar 2019 15:31:02 -0700 Subject: [PATCH] Fix a bug in the handling of C strings. The while loop will never exit due to the check `while(str)`, since str will never become null by increment. This should be checking the character pointed to by str. --- include/ac_int.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ac_int.h b/include/ac_int.h index 7672893..76bbfc0 100644 --- a/include/ac_int.h +++ b/include/ac_int.h @@ -2484,7 +2484,7 @@ __AC_INT_UTILITY_BASE // Zero Pads if str is too short, throws ms bits away if str is too long // Asserts if anything other than 0-9a-fA-F is encountered ac_int res = 0; - while(str) { + while(*str) { char c = *str; int h = 0; if(c >= '0' && c <= '9')