Skip to content

Commit 2513ed9

Browse files
Zishan Mirzazimirza
authored andcommitted
fix clang static analyzer and functions checker
1 parent 9d5fa73 commit 2513ed9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3578,13 +3578,13 @@ void StdLibraryFunctionsChecker::initFunctionSummaries(
35783578
addToFunctionSummaryMap(
35793579
"ctime_s",
35803580
Signature(ArgTypes{CharPtrTy,
3581-
BufferSize(ArgNo(1), BVF.getValue(26, IntTy)),
3581+
BufferSize(ArgNo(0), BVF.getValue(26, IntTy)),
35823582
ConstTime_tPtrTy},
35833583
RetType{CharPtrTy}),
35843584
Summary(NoEvalCall)
35853585
.ArgConstraint(NotNull(ArgNo(0)))
35863586
.ArgConstraint(BufferSize(
3587-
/*Buffer=*/ArgNo(1),
3587+
/*Buffer=*/ArgNo(0),
35883588
/*MinBufSize=*/BVF.getValue(26, IntTy))));
35893589
.ArgConstraint(NotNull(ArgNo(2)))
35903590

compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,7 @@ INTERCEPTOR(char *, ctime_s, char *result, size_t result_size,
14391439
// FIXME: under ASan the call below may write to freed memory and corrupt
14401440
// its metadata. See
14411441
// https://github.com/google/sanitizers/issues/321.
1442-
char *res = REAL(ctime_r)(result, result_size, timep);
1442+
char *res = REAL(ctime_s)(result, result_size, timep);
14431443
if (res) {
14441444
COMMON_INTERCEPTOR_READ_RANGE(ctx, timep, sizeof(*timep));
14451445
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, res, internal_strlen(res) + 1);

0 commit comments

Comments
 (0)