[all-commits] [llvm/llvm-project] 94b085: [sanitizer] use uptr to store the result of intern...
Enna1 via All-commits
all-commits at lists.llvm.org
Sun Aug 27 23:37:58 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 94b0851aad618397f508e56c63c6f928e4e911b9
https://github.com/llvm/llvm-project/commit/94b0851aad618397f508e56c63c6f928e4e911b9
Author: Enna1 <xumingjie.enna1 at bytedance.com>
Date: 2023-08-28 (Mon, 28 Aug 2023)
Changed paths:
M compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_format.inc
A compiler-rt/test/sanitizer_common/TestCases/vsnprintf.cpp
Log Message:
-----------
[sanitizer] use uptr to store the result of internal_strlen/internal_strnlen in printf_common
The return type of `internal_strlen()` is 'uptr', but in `printf_common()` we store the result of `internal_strlen()` into an 'int' type variable.
When the result value of `internal_strlen()` is larger than the largest possible value of 'int' type, the implicit conversion from 'uptr' to 'int' will change the result value to a negative value.
Without this change, asan reports a false positive negative-size-param in the added testcase.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D157266
More information about the All-commits
mailing list