From 22fd8353e83bf78ee1943ff617117c26dc871324 Mon Sep 17 00:00:00 2001 From: lihaoxiang Date: Tue, 1 Nov 2022 03:16:42 +0000 Subject: [PATCH] add 0001-Fix-an-runtime-error-reported-by-undefind-sanitizer.patch. --- ...error-reported-by-undefind-sanitizer.patch | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 0001-Fix-an-runtime-error-reported-by-undefind-sanitizer.patch diff --git a/0001-Fix-an-runtime-error-reported-by-undefind-sanitizer.patch b/0001-Fix-an-runtime-error-reported-by-undefind-sanitizer.patch new file mode 100644 index 0000000..c81f7ec --- /dev/null +++ b/0001-Fix-an-runtime-error-reported-by-undefind-sanitizer.patch @@ -0,0 +1,30 @@ +From 96d775860fb7e404d6acaf7e8dfbd171cfbcee15 Mon Sep 17 00:00:00 2001 +From: Han Han +Date: Mon, 20 Jun 2022 16:45:19 +0800 +Subject: [PATCH] Fix an runtime error reported by undefind sanitizer + +Fix the following error when compiling with undefined sanitizer: + +./lsusb +names.c:36:29: runtime error: left shift of 16 by 27 places cannot be represented in type 'int' + +Signed-off-by: Han Han +--- + names.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/names.c b/names.c +index c8cdd02..beae8f8 100644 +--- a/names.c ++++ b/names.c +@@ -33,7 +33,7 @@ + + static unsigned int hashnum(unsigned int num) + { +- unsigned int mask1 = HASH1 << 27, mask2 = HASH2 << 27; ++ unsigned int mask1 = (unsigned int)HASH1 << 27, mask2 = (unsigned int)HASH2 << 27; + + for (; mask1 >= HASH1; mask1 >>= 1, mask2 >>= 1) + if (num & mask1) +-- +2.37.0.windows.1 \ No newline at end of file -- Gitee