@@ -324,6 +343,60 @@ void error_fseek_0(void) {
fclose(F);
}
+void error_fseeko_0(void) {
+ FILE *F = fopen("file", "r");
+ if (!F)
+return;
+ int rc = fseeko(F, 0, SEEK_SET);
+ if (rc) {
+int IsFEof = feof(F), IsFError = ferror(F);
+// Get ferror or no error
@@ -268,8 +268,12 @@ class StreamChecker : public Checkerhttps://github.com/llvm/llvm-project/pull/77580
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske closed
https://github.com/llvm/llvm-project/pull/74627
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske deleted
https://github.com/llvm/llvm-project/pull/77580
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske deleted
https://github.com/llvm/llvm-project/pull/77580
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske approved this pull request.
https://github.com/llvm/llvm-project/pull/77580
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Author: Balázs Kéri
Date: 2022-03-28T10:55:26+02:00
New Revision: c5d83cdca457fd024a3f76c5e2ba649462ecde67
URL:
https://github.com/llvm/llvm-project/commit/c5d83cdca457fd024a3f76c5e2ba649462ecde67
DIFF:
https://github.com/llvm/llvm-project/commit/c5d83cdca457fd024a3f76c5e2ba649462ecde67.diff
L
Author: Balázs Kéri
Date: 2022-08-05T10:32:53+02:00
New Revision: 501faaa0d65e9814566ef65e58d834c13b8a
URL:
https://github.com/llvm/llvm-project/commit/501faaa0d65e9814566ef65e58d834c13b8a
DIFF:
https://github.com/llvm/llvm-project/commit/501faaa0d65e9814566ef65e58d834c13b8a.diff
L
Author: Balázs Kéri
Date: 2022-08-09T09:20:06+02:00
New Revision: d4ff9eff767c24716b5654780bc2e48c2017b4c5
URL:
https://github.com/llvm/llvm-project/commit/d4ff9eff767c24716b5654780bc2e48c2017b4c5
DIFF:
https://github.com/llvm/llvm-project/commit/d4ff9eff767c24716b5654780bc2e48c2017b4c5.diff
L
Author: Balázs Kéri
Date: 2022-08-10T12:00:16+02:00
New Revision: a772f775a2ba401e95a0bbe73deb6300f1dc12c0
URL:
https://github.com/llvm/llvm-project/commit/a772f775a2ba401e95a0bbe73deb6300f1dc12c0
DIFF:
https://github.com/llvm/llvm-project/commit/a772f775a2ba401e95a0bbe73deb6300f1dc12c0.diff
L
Author: Balázs Kéri
Date: 2021-07-15T10:02:18+02:00
New Revision: b0d38ad0bc254b887123cd063a5f0db30a80f938
URL:
https://github.com/llvm/llvm-project/commit/b0d38ad0bc254b887123cd063a5f0db30a80f938
DIFF:
https://github.com/llvm/llvm-project/commit/b0d38ad0bc254b887123cd063a5f0db30a80f938.diff
L
Author: Balázs Kéri
Date: 2021-07-21T08:54:11+02:00
New Revision: 90cb5297adf086073f14d455050b5cde9a03503d
URL:
https://github.com/llvm/llvm-project/commit/90cb5297adf086073f14d455050b5cde9a03503d
DIFF:
https://github.com/llvm/llvm-project/commit/90cb5297adf086073f14d455050b5cde9a03503d.diff
L
Author: Balázs Kéri
Date: 2021-07-22T13:09:42+02:00
New Revision: 41adc09b221170065e227f43c7fd21ffce5e2a6e
URL:
https://github.com/llvm/llvm-project/commit/41adc09b221170065e227f43c7fd21ffce5e2a6e
DIFF:
https://github.com/llvm/llvm-project/commit/41adc09b221170065e227f43c7fd21ffce5e2a6e.diff
L
Author: Balázs Kéri
Date: 2022-04-07T09:38:58+02:00
New Revision: cc7ed0caaca58bb38c789dcf2e0aade5f68f1e02
URL:
https://github.com/llvm/llvm-project/commit/cc7ed0caaca58bb38c789dcf2e0aade5f68f1e02
DIFF:
https://github.com/llvm/llvm-project/commit/cc7ed0caaca58bb38c789dcf2e0aade5f68f1e02.diff
L
Author: Balázs Kéri
Date: 2022-04-07T11:07:15+02:00
New Revision: 5479174071ec7d4692959bbdc15b5bb79e268e00
URL:
https://github.com/llvm/llvm-project/commit/5479174071ec7d4692959bbdc15b5bb79e268e00
DIFF:
https://github.com/llvm/llvm-project/commit/5479174071ec7d4692959bbdc15b5bb79e268e00.diff
L
Author: Balázs Kéri
Date: 2022-04-12T10:02:51+02:00
New Revision: 2b6e5fa62b80f4c0ca540e2fc0ebe3b15e50b78a
URL:
https://github.com/llvm/llvm-project/commit/2b6e5fa62b80f4c0ca540e2fc0ebe3b15e50b78a
DIFF:
https://github.com/llvm/llvm-project/commit/2b6e5fa62b80f4c0ca540e2fc0ebe3b15e50b78a.diff
L
Author: Balázs Kéri
Date: 2022-04-13T10:11:33+02:00
New Revision: 596752863e27e6b4b89e34ecfcf5317a5bf46b52
URL:
https://github.com/llvm/llvm-project/commit/596752863e27e6b4b89e34ecfcf5317a5bf46b52
DIFF:
https://github.com/llvm/llvm-project/commit/596752863e27e6b4b89e34ecfcf5317a5bf46b52.diff
L
Author: Balázs Kéri
Date: 2022-02-07T12:57:58+01:00
New Revision: c63522e6ba7782c335043893ae7cbd37eca24fe5
URL:
https://github.com/llvm/llvm-project/commit/c63522e6ba7782c335043893ae7cbd37eca24fe5
DIFF:
https://github.com/llvm/llvm-project/commit/c63522e6ba7782c335043893ae7cbd37eca24fe5.diff
L
Author: Balázs Kéri
Date: 2022-02-07T14:56:27+01:00
New Revision: 29fc5e0245cb360387cb8daac52c13dbc390fafd
URL:
https://github.com/llvm/llvm-project/commit/29fc5e0245cb360387cb8daac52c13dbc390fafd
DIFF:
https://github.com/llvm/llvm-project/commit/29fc5e0245cb360387cb8daac52c13dbc390fafd.diff
L
Author: Balázs Kéri
Date: 2022-02-14T08:27:44+01:00
New Revision: 83028ad934d60b024b5b0272cb68523232715dab
URL:
https://github.com/llvm/llvm-project/commit/83028ad934d60b024b5b0272cb68523232715dab
DIFF:
https://github.com/llvm/llvm-project/commit/83028ad934d60b024b5b0272cb68523232715dab.diff
L
Author: Balázs Kéri
Date: 2022-07-14T09:04:03+02:00
New Revision: 0e95921bc303a206cc6ae1c21ee90ec223bf9e78
URL:
https://github.com/llvm/llvm-project/commit/0e95921bc303a206cc6ae1c21ee90ec223bf9e78
DIFF:
https://github.com/llvm/llvm-project/commit/0e95921bc303a206cc6ae1c21ee90ec223bf9e78.diff
L
Author: Balázs Kéri
Date: 2022-07-25T09:23:14+02:00
New Revision: 94ca2beccc595c89c37eb3e5215ac97c3d930c8f
URL:
https://github.com/llvm/llvm-project/commit/94ca2beccc595c89c37eb3e5215ac97c3d930c8f
DIFF:
https://github.com/llvm/llvm-project/commit/94ca2beccc595c89c37eb3e5215ac97c3d930c8f.diff
L
Author: Balázs Kéri
Date: 2022-07-25T10:28:01+02:00
New Revision: acd80a29ae7dcffabcb41e8579ebf4f371f0ddd7
URL:
https://github.com/llvm/llvm-project/commit/acd80a29ae7dcffabcb41e8579ebf4f371f0ddd7
DIFF:
https://github.com/llvm/llvm-project/commit/acd80a29ae7dcffabcb41e8579ebf4f371f0ddd7.diff
L
@@ -1090,7 +1090,8 @@ static bool isStandardNewDelete(const FunctionDecl *FD) {
// If the header for operator delete is not included, it's still defined
// in an invalid source location. Check to make sure we don't crash.
return !L.isValid() ||
- FD->getASTContext
balazske wrote:
> So, it seems removing them from `StdLibraryFunctionsChecker` is not out of
> the question. We can leave them together with other stream functions, or we
> could move them to `UnixAPIChecker`, which we have enabled downstream.
>
> I think the latter is a reasonable compromise
balazske wrote:
> @balazske Are you interested in refactoring the logic of
> `StdLibraryFunctionsChecker` into an API that can be used by separate
> checkers?
I could try it. It would solve at least the (dependency) difficulties related
to this checker. Probably the checker can remain and con
@@ -1204,6 +1204,20 @@ void StreamChecker::evalGetdelim(const FnDescription
*Desc,
State->BindExpr(E.CE, C.getLocationContext(), RetVal);
StateNotFailed =
E.assumeBinOpNN(StateNotFailed, BO_GE, RetVal, E.getZeroVal(Call));
+// The buffer size `*n` must
@@ -1179,6 +1195,113 @@ void StreamChecker::evalUngetc(const FnDescription
*Desc, const CallEvent &Call,
C.addTransition(StateFailed);
}
+ProgramStateRef StreamChecker::ensureGetdelimBufferAndSizeCorrect(
+SVal LinePtrPtrSVal, SVal SizePtrSVal, const Expr *LinePtrPtrExp
@@ -1204,6 +1204,20 @@ void StreamChecker::evalGetdelim(const FnDescription
*Desc,
State->BindExpr(E.CE, C.getLocationContext(), RetVal);
StateNotFailed =
E.assumeBinOpNN(StateNotFailed, BO_GE, RetVal, E.getZeroVal(Call));
+// The buffer size `*n` must
@@ -1217,6 +1231,11 @@ void StreamChecker::evalGetdelim(const FnDescription
*Desc,
E.isStreamEof() ? ErrorFEof : ErrorFEof | ErrorFError;
StateFailed = E.setStreamState(
StateFailed, StreamState::getOpened(Desc, NewES, !NewES.isFEof()));
+ // On failure, the con
@@ -1204,6 +1204,20 @@ void StreamChecker::evalGetdelim(const FnDescription
*Desc,
State->BindExpr(E.CE, C.getLocationContext(), RetVal);
StateNotFailed =
E.assumeBinOpNN(StateNotFailed, BO_GE, RetVal, E.getZeroVal(Call));
+// The buffer size `*n` must
@@ -376,3 +377,122 @@ void fflush_on_open_failed_stream(void) {
}
fclose(F);
}
+
+void getline_null_file() {
+ char *buffer = NULL;
+ size_t n = 0;
+ getline(&buffer, &n, NULL); // expected-warning {{Stream pointer might be
NULL}}
+}
+
+void getdelim_null_file() {
+ ch
@@ -376,3 +377,122 @@ void fflush_on_open_failed_stream(void) {
}
fclose(F);
}
+
+void getline_null_file() {
+ char *buffer = NULL;
+ size_t n = 0;
+ getline(&buffer, &n, NULL); // expected-warning {{Stream pointer might be
NULL}}
+}
+
+void getdelim_null_file() {
+ ch
@@ -376,3 +377,122 @@ void fflush_on_open_failed_stream(void) {
}
fclose(F);
}
+
+void getline_null_file() {
+ char *buffer = NULL;
+ size_t n = 0;
+ getline(&buffer, &n, NULL); // expected-warning {{Stream pointer might be
NULL}}
+}
+
+void getdelim_null_file() {
+ ch
@@ -376,3 +377,122 @@ void fflush_on_open_failed_stream(void) {
}
fclose(F);
}
+
+void getline_null_file() {
+ char *buffer = NULL;
+ size_t n = 0;
+ getline(&buffer, &n, NULL); // expected-warning {{Stream pointer might be
NULL}}
+}
+
+void getdelim_null_file() {
+ ch
@@ -376,3 +377,122 @@ void fflush_on_open_failed_stream(void) {
}
fclose(F);
}
+
+void getline_null_file() {
+ char *buffer = NULL;
+ size_t n = 0;
+ getline(&buffer, &n, NULL); // expected-warning {{Stream pointer might be
NULL}}
+}
+
+void getdelim_null_file() {
+ ch
https://github.com/balazske approved this pull request.
I did not find more issues (at least in `StreamChecker` and its tests). But did
not check in detail the `UnixAPIChecker` part and tests.
https://github.com/llvm/llvm-project/pull/83027
___
cfe-co
@@ -376,3 +377,75 @@ void fflush_on_open_failed_stream(void) {
}
fclose(F);
}
+
+void getline_null_file() {
+ char *buffer = NULL;
+ size_t n = 0;
+ getline(&buffer, &n, NULL); // expected-warning {{Stream pointer might be
NULL}}
+}
+
+void getdelim_null_file() {
+ cha
balazske wrote:
It looks like that this change causes crashes on many projects (curl, vim,
postgres, others) in `RAIIMutexDescriptor::initIdentifierInfo`.
https://github.com/llvm/llvm-project/pull/80029
___
cfe-commits mailing list
cfe-commits@lists.l
https://github.com/balazske created
https://github.com/llvm/llvm-project/pull/86919
Until now function `fseek` returned nonzero on error, this is changed to -1
only. And it does not produce EOF error any more.
This complies better with the POSIX standard.
From b6c76404c2f0b0e960adcadd7f089ecc5
@@ -2515,6 +2517,53 @@ void CStringChecker::evalSprintfCommon(CheckerContext
&C, const CallEvent &Call,
C.addTransition(State);
}
+void CStringChecker::evalGetentropy(CheckerContext &C, const CallEvent &Call)
const {
+ DestinationArgExpr Buffer = {{Call.getArgExpr(0), 0}}
https://github.com/balazske closed
https://github.com/llvm/llvm-project/pull/83858
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske closed
https://github.com/llvm/llvm-project/pull/86919
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske created
https://github.com/llvm/llvm-project/pull/87322
The checker may create failure branches for all stream write operations only if
the new option "pedantic" is set to true.
Result of the write operations is often not checked in typical code. If failure
branches
balazske wrote:
> Unless you plan to add more heuristics, I'd prefer a more concrete option
> name, like AssumeSuccessfulWrites=true. This would better describe it imo.
I do not like totally the name "Pedantic", it could be
"AssumeOftenUncheckedOperationsMayFail". I am not sure if this behavio
@@ -57,6 +61,12 @@ class BlockInCriticalSectionChecker : public
Checker {
const CallEvent &call,
CheckerContext &C) const;
+ CritSectionMarker getCriticalSectionMarker(const CallEvent &Call,
+
@@ -57,6 +61,12 @@ class BlockInCriticalSectionChecker : public
Checker {
const CallEvent &call,
CheckerContext &C) const;
+ CritSectionMarker getCriticalSectionMarker(const CallEvent &Call,
+
https://github.com/balazske closed
https://github.com/llvm/llvm-project/pull/76979
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske created
https://github.com/llvm/llvm-project/pull/81138
This checker does not exist (any more?) but appeared in the documentation. No
other references to CallAndMessageUnInitRefArg are found in the full clang code.
From b9f0e178ab08286fda1c11e96e2ad46ab75ecf8b Mon S
https://github.com/balazske updated
https://github.com/llvm/llvm-project/pull/80457
From 1f65abda712efce624c01ec99675c8261a8e6cea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Wed, 31 Jan 2024 17:40:21 +0100
Subject: [PATCH] {clang][analyzer] Change default value of c
balazske wrote:
The change was evaluated on the following projects. "Lost reports" shows
results that disappear if the `ModelPOSIX` option is changed to true. "New
reports" shows the new results. Many of the new results come from the large
number of modeled functions. The lost reports are more
https://github.com/balazske created
https://github.com/llvm/llvm-project/pull/81461
This is only a code reformatting and rename of variables to the newer format.
From d1078be3394fc240de014f72116e18d6740b5773 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Mon, 12 Feb 2
https://github.com/balazske closed
https://github.com/llvm/llvm-project/pull/81138
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
balazske wrote:
The new appeared bug reports should be similar to the ones that were observed
when `StdCLibraryFunctionsChecker` was made non-alpha (and probably were
checked already one time) (because the option was turned on in those tests).
A different solution can be to add a Linux-mode for
balazske wrote:
> * a [straightforward leak of a string returned by
> `strdup()`](https://codechecker-demo.eastus.cloudapp.azure.com/Default/report-detail?run=postgres_REL_13_0_modelposix_defaulton&newcheck=postgres_REL_13_0_modelposix_defaultoff&is-unique=on&diff-type=New&report-id=3467892&repo
balazske wrote:
Because the many cases with `fileno` I can agree to change the summary so we
assume that it never fails. Probably an other checker may find a case if the
passed file handle is invalid because it was not initialized, or the file was
already closed (`StreamChecker` should find th
@@ -3020,44 +3020,82 @@ Check for misuses of stream APIs. Check for misuses of
stream APIs: ``fopen, fcl
alpha.unix.Stream (C)
"
-Check stream handling functions: ``fopen, tmpfile, fclose, fread, fwrite,
fseek, ftell, rewind, fgetpos,``
-``fsetpos, cleare
balazske wrote:
Currently it looks OK to add `getentropy` to this checker because it is a
string related function in a way. Otherwise it looks like that many of the
checks (for buffer access, and buffer invalidations) that are implemented in
`CStringChecker` could be moved to `StdLibraryFuncti
https://github.com/balazske created
https://github.com/llvm/llvm-project/pull/84191
These functions should not be allowed if the file position is indeterminate
(they return the file position).
This condition is now checked, and tests are improved to check it.
From f5e2ba88eb79d778daf9d3e8f55a5
https://github.com/balazske updated
https://github.com/llvm/llvm-project/pull/84191
From dbaf3348510582c013254ed48b69663b42816be0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Wed, 6 Mar 2024 16:01:01 +0100
Subject: [PATCH] [clang][analyzer] Fix StreamChecker `ftell`
@@ -880,6 +883,24 @@ void StreamChecker::preReadWrite(const FnDescription *Desc,
}
}
+void StreamChecker::preWrite(const FnDescription *Desc, const CallEvent &Call,
balazske wrote:
The `CallDescriptionMap` was uncomfortable to handle because too many
`std:
@@ -603,6 +611,8 @@ void ArrayBoundCheckerV2::performCheck(const Expr *E,
CheckerContext &C) const {
auto [WithinUpperBound, ExceedsUpperBound] =
compareValueToThreshold(State, ByteOffset, *KnownSize, SVB);
+bool AssumedNonNegative = SUR.assumedNonNegative();
@@ -603,6 +611,8 @@ void ArrayBoundCheckerV2::performCheck(const Expr *E,
CheckerContext &C) const {
auto [WithinUpperBound, ExceedsUpperBound] =
compareValueToThreshold(State, ByteOffset, *KnownSize, SVB);
+bool AssumedNonNegative = SUR.assumedNonNegative();
balazske wrote:
The change looks correct, but it would be more accurate if 3 different index
error cases would be possible, index is too small (negative), too large, or can
be both too small and too large.
https://github.com/llvm/llvm-project/pull/84201
balazske wrote:
`StreamChecker` still does not check for all possible NULL pointer errors. At
`fread` and `fwrite` for example there is no check for NULL buffer pointer. The
reason is that these are checked in `StdLibraryFunctionsChecker`. Probably it
would be better to add the checks for prec
https://github.com/balazske closed
https://github.com/llvm/llvm-project/pull/84191
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
balazske wrote:
Additionally, the checked preconditions look not exact. For example the POSIX
documentation for `getdelim` says: "If *n is non-zero, the application shall
ensure that *lineptr either points to an object of size at least *n bytes, or
is a null pointer." This means `*lineptr` can
https://github.com/balazske edited
https://github.com/llvm/llvm-project/pull/83027
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske commented:
This functionality could be added to this checker, but to
`StdLibraryFunctionsChecker` too, and probably will be added at a time (summary
of `getdelim` is not accurate now in that checker). The same bug condition is
checked by two different checkers in th
@@ -234,6 +235,9 @@ class StreamChecker : public Checkerhttps://github.com/llvm/llvm-project/pull/83027
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1158,6 +1173,118 @@ void StreamChecker::evalUngetc(const FnDescription
*Desc, const CallEvent &Call,
C.addTransition(StateFailed);
}
+ProgramStateRef
+StreamChecker::ensurePtrNotNull(SVal PtrVal, const Expr *PtrExpr,
+CheckerContext &C, P
@@ -1158,6 +1173,118 @@ void StreamChecker::evalUngetc(const FnDescription
*Desc, const CallEvent &Call,
C.addTransition(StateFailed);
}
+ProgramStateRef
+StreamChecker::ensurePtrNotNull(SVal PtrVal, const Expr *PtrExpr,
+CheckerContext &C, P
@@ -510,6 +517,14 @@ class StreamChecker : public Checkerhttps://github.com/llvm/llvm-project/pull/83027
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1158,6 +1173,118 @@ void StreamChecker::evalUngetc(const FnDescription
*Desc, const CallEvent &Call,
C.addTransition(StateFailed);
}
+ProgramStateRef
+StreamChecker::ensurePtrNotNull(SVal PtrVal, const Expr *PtrExpr,
+CheckerContext &C, P
@@ -1158,6 +1173,118 @@ void StreamChecker::evalUngetc(const FnDescription
*Desc, const CallEvent &Call,
C.addTransition(StateFailed);
}
+ProgramStateRef
+StreamChecker::ensurePtrNotNull(SVal PtrVal, const Expr *PtrExpr,
+CheckerContext &C, P
balazske wrote:
I want to avoid that some functions have null pointer checks in
`StreamChecker`, some not. If this change is merged then it would be good to
add null pointer checks to other functions like `fread` and `fwrite`. (Until
now only the NULL stream pointer was checked.)
https://gith
https://github.com/balazske approved this pull request.
I am not totally sure but this looks correct with the new variable names and
there are some tests for the new case.
https://github.com/llvm/llvm-project/pull/84201
___
cfe-commits mailing list
cf
https://github.com/balazske edited
https://github.com/llvm/llvm-project/pull/84201
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -83,6 +83,8 @@ class StateUpdateReporter {
AssumedUpperBound = UpperBoundVal;
}
+ bool assumedNonNegative() { return AssumedNonNegative; }
balazske wrote:
This should be called `getAssumedNonNegative` or `hasAssumedNonNegative` (but
the naming rule
@@ -339,3 +363,138 @@ void fflush_on_open_failed_stream(void) {
}
fclose(F);
}
+
+void test_fscanf_eof() {
+ FILE *F1 = tmpfile();
+ if (!F1)
+return;
+
+ int a;
+ unsigned b;
+ int ret = fscanf(F1, "%d %u", &a, &b);
+ char c = fgetc(F1); // expected-warning {{Rea
https://github.com/balazske edited
https://github.com/llvm/llvm-project/pull/82476
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske requested changes to this pull request.
I would like better if the new tests that are invalidation-related are moved to
file **stream-invalidate.c** (this was added in the recent commit).
https://github.com/llvm/llvm-project/pull/82476
___
@@ -339,3 +363,138 @@ void fflush_on_open_failed_stream(void) {
}
fclose(F);
}
+
+void test_fscanf_eof() {
balazske wrote:
Has this test a purpose that is different from test `error_fscanf` in
**stream_error.c**?
https://github.com/llvm/llvm-project/pull
@@ -339,3 +363,138 @@ void fflush_on_open_failed_stream(void) {
}
fclose(F);
}
+
+void test_fscanf_eof() {
+ FILE *F1 = tmpfile();
+ if (!F1)
+return;
+
+ int a;
+ unsigned b;
+ int ret = fscanf(F1, "%d %u", &a, &b);
+ char c = fgetc(F1); // expected-warning {{Rea
@@ -339,3 +363,138 @@ void fflush_on_open_failed_stream(void) {
}
fclose(F);
}
+
+void test_fscanf_eof() {
+ FILE *F1 = tmpfile();
+ if (!F1)
+return;
+
+ int a;
+ unsigned b;
+ int ret = fscanf(F1, "%d %u", &a, &b);
+ char c = fgetc(F1); // expected-warning {{Rea
@@ -339,3 +363,138 @@ void fflush_on_open_failed_stream(void) {
}
fclose(F);
}
+
+void test_fscanf_eof() {
+ FILE *F1 = tmpfile();
+ if (!F1)
+return;
+
+ int a;
+ unsigned b;
+ int ret = fscanf(F1, "%d %u", &a, &b);
+ char c = fgetc(F1); // expected-warning {{Rea
https://github.com/balazske edited
https://github.com/llvm/llvm-project/pull/82476
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -65,12 +65,24 @@ void check_fseek(void) {
fclose(fp);
}
+void check_fseeko(void) {
balazske wrote:
If we have these null pointer tests for all functions, `vfprintf` and `vfscanf`
could be added too.
https://github.com/llvm/llvm-project/pull/82476
_
https://github.com/balazske commented:
I have only small observations.
https://github.com/llvm/llvm-project/pull/82476
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -5,7 +5,7 @@
// suppressed.
#pragma clang system_header
-typedef struct __sFILE {
balazske wrote:
This change looks not needed.
https://github.com/llvm/llvm-project/pull/82476
___
cfe-commits mailing list
cfe-co
https://github.com/balazske approved this pull request.
https://github.com/llvm/llvm-project/pull/82476
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske created
https://github.com/llvm/llvm-project/pull/83288
If a stream operation fails the position can become "indeterminate". This may
cause warning from the checker at a later operation. The new note tag shows the
place where the position becomes "indeterminate", th
balazske wrote:
Related to this, I want to change text "File position of the stream might be
'indeterminate'" to something better, or maybe only remove the `'` characters
from it.
https://github.com/llvm/llvm-project/pull/83288
___
cfe-commits mailin
https://github.com/balazske updated
https://github.com/llvm/llvm-project/pull/83288
From f5aeb6e97e73d317d55189c656c31a84757f9636 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Wed, 28 Feb 2024 17:51:29 +0100
Subject: [PATCH] [clang][analyzer] Add StreamChecker note ta
balazske wrote:
fixed formatting errors
https://github.com/llvm/llvm-project/pull/83288
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
balazske wrote:
Behavior of `fileno` is already changed in #81842.
I was thinking about that
> separate long-term solution
in last comment that it is already existing functionality (in StreamChecker and
other invalid pointer checkers).
Should we run again the checks (only modeling of `fileno`
@@ -218,87 +218,6 @@ inline void assertStreamStateOpened(const StreamState *SS)
{
assert(SS->isOpened() && "Stream is expected to be opened");
}
-struct StreamOperationEvaluator {
balazske wrote:
There should be something that is used from `StreamChecker`
@@ -313,6 +232,9 @@ class StreamChecker : public Checkerhttps://github.com/llvm/llvm-project/pull/83288
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/balazske updated
https://github.com/llvm/llvm-project/pull/83288
From f5aeb6e97e73d317d55189c656c31a84757f9636 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Wed, 28 Feb 2024 17:51:29 +0100
Subject: [PATCH 1/2] [clang][analyzer] Add StreamChecker not
https://github.com/balazske updated
https://github.com/llvm/llvm-project/pull/80457
From 1f65abda712efce624c01ec99675c8261a8e6cea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bal=C3=A1zs=20K=C3=A9ri?=
Date: Wed, 31 Jan 2024 17:40:21 +0100
Subject: [PATCH 1/2] {clang][analyzer] Change default value
201 - 300 of 829 matches
Mail list logo