AI review of 2026-11-30_16-33-35-90f9bee0e701-results.txt PR: #9092 https://github.com/cppcheck-opensource/cppcheck/pull/9092 Tested: 90f9bee0e701f52cf70bd3b9ecfccc427425eb42 Merge base: 6a4fedd30039c61578c8ba1bc482fecaed6b8a39 Reviewed: 2026-12-02 20:33:22 UTC Model: claude-opus-5-5 (effort high) Results: 13 reviewed of 13 in the report Verdicts: 13 improvement Tokens: 33215 input, 14903 cache read, 12774 cache write, 4736 output The verdicts are written by AI and can be wrong. ---- 1 / 13 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/k/kytensor/kytensor_2.49.0.7.orig.tar.gz Result: main kytensor-2.49.0.7/src/tracer.cc:167:47: warning: Possible null pointer dereference: current_setting [nullPointer] kytensor-2.49.0.7/src/tracer.cc:113:41: note: Assignment 'current_setting=nullptr', assigned value is 0 kytensor-2.49.0.7/src/tracer.cc:115:7: note: Assuming condition is true kytensor-2.49.0.7/src/tracer.cc:117:12: note: Assuming condition is false kytensor-2.49.0.7/src/tracer.cc:165:7: note: Assuming condition is true kytensor-2.49.0.7/src/tracer.cc:167:47: note: Null pointer dereference Explanation: When `level_specified` is true and `new_setting.level_ == nullptr`, the definition `level_specified = !clear_level_ && ((current_setting != nullptr && current_setting->level_specified_) || new_setting.level_ != nullptr)` forces `current_setting != nullptr`. So the dereference at line 167 is safe and the warning was a false positive. The PR makes the analysis look through a bool to the expression it is known to equal, so Cppcheck now sees this correlation and drops the warning. ---- 2 / 13 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/k/kytensor/kytensor_2.49.0.7.orig.tar.gz Result: main kytensor-2.49.0.7/src/tracer.cc:171:45: warning: Possible null pointer dereference: current_setting [nullPointer] kytensor-2.49.0.7/src/tracer.cc:113:41: note: Assignment 'current_setting=nullptr', assigned value is 0 kytensor-2.49.0.7/src/tracer.cc:115:7: note: Assuming condition is true kytensor-2.49.0.7/src/tracer.cc:117:12: note: Assuming condition is false kytensor-2.49.0.7/src/tracer.cc:169:7: note: Assuming condition is true kytensor-2.49.0.7/src/tracer.cc:171:45: note: Null pointer dereference Explanation: `rate_specified` is true only if `new_setting.clear_rate_` is false and either `current_setting != nullptr && current_setting->rate_specified_` or `new_setting.rate_ != nullptr`. Line 171 dereferences `current_setting` only when `new_setting.rate_ == nullptr`, so `current_setting` must be non-null there. The warning was a false positive. The PR lets Cppcheck follow what the bool condition means instead of only its 0/1 range, which removes this false positive. ---- 3 / 13 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/l/llama.cpp/llama.cpp_1.1.0+dfsg.orig.tar.xz Result: main llama.cpp-1.1.0/src/llama-kv-cache.cpp:243:84: warning:inconclusive: Possible null pointer dereference: k [nullPointer] llama.cpp-1.1.0/src/llama-kv-cache.cpp:233:27: note: Assuming condition 'has_k' is false llama.cpp-1.1.0/src/llama-kv-cache.cpp:233:33: note: Assignment 'k=has_k?ggml_new_tensor_3d(ctx,type_k,n_embd_k_gqa,kv_size,n_stream):nullptr', assigned value is 0 llama.cpp-1.1.0/src/llama-kv-cache.cpp:243:84: note: Null pointer dereference Explanation: Line 243 dereferences k (k->nb[1]) only inside the true branch of 'has_k ? ... : nullptr'. k is null only when has_k is false, and that is the same condition that selects the nullptr branch. has_k is also the constant true, so k can never be null at that point. The old warning was a false positive. The PR makes stateCoversCondition handle bool conditions correctly, and the warning is now gone. ---- 4 / 13 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/l/llama.cpp/llama.cpp_1.1.0+dfsg.orig.tar.xz Result: main llama.cpp-1.1.0/src/llama-kv-cache.cpp:243:96: warning:inconclusive: Possible null pointer dereference: k [nullPointer] llama.cpp-1.1.0/src/llama-kv-cache.cpp:233:27: note: Assuming condition 'has_k' is false llama.cpp-1.1.0/src/llama-kv-cache.cpp:233:33: note: Assignment 'k=has_k?ggml_new_tensor_3d(ctx,type_k,n_embd_k_gqa,kv_size,n_stream):nullptr', assigned value is 0 llama.cpp-1.1.0/src/llama-kv-cache.cpp:243:96: note: Null pointer dereference Explanation: `has_k` is a constant `true`. Even when it was false, `k` would be nullptr only in that same case, and the dereference `k->nb[2]` at line 243 is guarded by `has_k ? ... : nullptr`. So `k` cannot be null where it is dereferenced. The warning claimed 'Assuming has_k is false' leads to null, but that path never reaches the dereference. This was a false positive. The PR makes Cppcheck use the condition a bool is known to equal, instead of its uninformative 0..1 range, so it now sees that the guard covers the dereference. Removing the warning is correct. ---- 5 / 13 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/l/llama.cpp/llama.cpp_1.1.0+dfsg.orig.tar.xz Result: main llama.cpp-1.1.0/src/llama-kv-cache.cpp:244:84: warning:inconclusive: Possible null pointer dereference: v [nullPointer] llama.cpp-1.1.0/src/llama-kv-cache.cpp:234:27: note: Assuming condition 'has_v' is false llama.cpp-1.1.0/src/llama-kv-cache.cpp:234:33: note: Assignment 'v=has_v?ggml_new_tensor_3d(ctx,type_v,n_embd_v_gqa,kv_size,n_stream):nullptr', assigned value is 0 llama.cpp-1.1.0/src/llama-kv-cache.cpp:244:84: note: Null pointer dereference Explanation: At line 244, `v->nb[1]` is only evaluated when `has_v` is true, because it sits in the true branch of `has_v ? ... : nullptr`. When `has_v` is true, `v` was assigned the result of `ggml_new_tensor_3d` on line 234, not nullptr. `has_v` is a const bool and is not modified in between. So the nullPointer warning (assuming has_v false, then dereferencing v) is a false positive. The PR makes Cppcheck use the expression a bool is known to equal when checking conditions, which lets it see that the same condition guards both the assignment and the dereference. Removing this warning is an improvement. ---- 6 / 13 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/l/llama.cpp/llama.cpp_1.1.0+dfsg.orig.tar.xz Result: main llama.cpp-1.1.0/src/llama-kv-cache.cpp:244:96: warning:inconclusive: Possible null pointer dereference: v [nullPointer] llama.cpp-1.1.0/src/llama-kv-cache.cpp:234:27: note: Assuming condition 'has_v' is false llama.cpp-1.1.0/src/llama-kv-cache.cpp:234:33: note: Assignment 'v=has_v?ggml_new_tensor_3d(ctx,type_v,n_embd_v_gqa,kv_size,n_stream):nullptr', assigned value is 0 llama.cpp-1.1.0/src/llama-kv-cache.cpp:244:96: note: Null pointer dereference Explanation: At line 244, `v->nb[2]` is only evaluated when `has_v` is true, and `v` is non-null exactly when `has_v` is true (line 234 assigns nullptr only when `has_v` is false). The loop condition `s < n_stream` must not make Cppcheck forget that the bool `has_v` carries the same information in both ternaries. The PR fixes stateCoversCondition for bools whose only known value is the impossible range: it now follows the symbolic expression the bool equals instead. Removing this false positive is an improvement. ---- 7 / 13 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/n/nsis/nsis_3.13.orig.tar.xz Result: main nsis-3.13/Source/script.cpp:3051:25: warning: Uninitialized variable: *out_path [uninitvar] nsis-3.13/Source/script.cpp:3043:13: note: Assuming condition is true nsis-3.13/Source/script.cpp:3051:25: note: Uninitialized variable: *out_path Explanation: `out_path` is left uninitialized only when `badpath` is true. In that case `badpath || !*out_path` short-circuits, so `*out_path` is never read. When `badpath` is false, `my_strncpy` has already filled `out_path`. The removed uninitvar warning, which came from 'Assuming condition is true' on `badpath`, was therefore a false positive. The PR fixes exactly this case: it lets `stateCoversCondition` look through a bool variable to the expression it was initialized from, so Cppcheck now tracks the correlation correctly. ---- 8 / 13 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/o/okteta/okteta_0.26.28.orig.tar.xz Result: main okteta-0.26.28/kasten/controllers/document/info/documentinfotool.cpp:99:24: warning: Possible null pointer dereference: mByteArrayModel [nullPointer] okteta-0.26.28/kasten/controllers/document/info/documentinfotool.cpp:91:23: note: Assuming condition 'mDocument' is false okteta-0.26.28/kasten/controllers/document/info/documentinfotool.cpp:91:33: note: Assignment 'mByteArrayModel=mDocument?mDocument->content():nullptr', assigned value is 0 okteta-0.26.28/kasten/controllers/document/info/documentinfotool.cpp:97:9: note: Assuming condition is true okteta-0.26.28/kasten/controllers/document/info/documentinfotool.cpp:99:24: note: Null pointer dereference Explanation: hasDocument is (mDocument != nullptr). If hasDocument is true, mDocument is non-null, so mByteArrayModel = mDocument->content() was taken from the non-null branch of the ternary. The warning's path assumes mDocument is false and then assumes hasDocument is true, which cannot happen together. The old warning was a false positive. The PR makes Cppcheck use the bool's symbolic equivalence when checking conditions, which removes it. ---- 9 / 13 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/o/okteta/okteta_0.26.28.orig.tar.xz Result: main okteta-0.26.28/kasten/gui/io/streamencoder/xxencoding/bytearrayxxencodingstreamencoder.cpp:158:33: warning: Uninitialized variable: bitsFromLastByte [uninitvar] okteta-0.26.28/kasten/gui/io/streamencoder/xxencoding/bytearrayxxencodingstreamencoder.cpp:119:47: note: Assuming condition is false okteta-0.26.28/kasten/gui/io/streamencoder/xxencoding/bytearrayxxencodingstreamencoder.cpp:157:9: note: Assuming condition is true okteta-0.26.28/kasten/gui/io/streamencoder/xxencoding/bytearrayxxencodingstreamencoder.cpp:158:33: note: Uninitialized variable: bitsFromLastByte Explanation: The removed warning was a false positive. `inputByteIndex` starts as `InputByteIndex::First` before the loop. The warning's path assumes the loop at line 119 never runs, yet `hasBitsLeft` is true. If the loop never runs, `inputByteIndex` stays `First`, so `hasBitsLeft` (defined as `inputByteIndex != First`) is false and line 158 is not reached. If `inputByteIndex` is not `First`, the loop has run at least once through the `First` case, which assigns `bitsFromLastByte`. So the variable is never read uninitialized. The PR stops treating the bool's trivial range as covering the condition. It instead uses the expression the bool is known to equal, so this impossible path is correctly dropped. ---- 10 / 13 ---- Verdict: IMPROVEMENT (medium confidence) Package: https://ftp.debian.org/debian/pool/main/o/openems/openems_0.0.35+git20190103.6a75e98+dfsg.1.orig.tar.bz2 Result: main openems-0.0.35+git20190103.6a75e98+dfsg.1/QCSXCAD/QVTKStructure.cpp:662:29: warning: Uninitialized variable: dCoords [uninitvar] openems-0.0.35+git20190103.6a75e98+dfsg.1/QCSXCAD/QVTKStructure.cpp:654:29: note: Assuming condition is false openems-0.0.35+git20190103.6a75e98+dfsg.1/QCSXCAD/QVTKStructure.cpp:661:10: note: Assuming condition is true openems-0.0.35+git20190103.6a75e98+dfsg.1/QCSXCAD/QVTKStructure.cpp:662:29: note: Uninitialized variable: dCoords Explanation: The warning path assumes the fill loop at line 654 never runs, which only happens when nrP == 0. In that case dCoords is a zero-length VLA, and AddLinePoly is called with a point count of 0, so no uninitialized element can be read. Whenever nrP > 0, the loop writes every element before the call. The removed uninitvar warning was therefore a false positive. The PR changes how the bool condition `isCurve` is evaluated and plausibly drops this spurious path. Confidence is medium because the exact mechanism behind the removal is not fully clear. ---- 11 / 13 ---- Verdict: IMPROVEMENT (medium confidence) Package: https://ftp.debian.org/debian/pool/main/p/paraview/paraview_6.1.1+dfsg1.orig.tar.gz Result: main Utilities/VisItBridge/databases/readers/SAS/avtSASFileFormat.C:520:34: warning:inconclusive: Possible null pointer dereference: pType [nullPointer] Utilities/VisItBridge/databases/readers/SAS/avtSASFileFormat.C:498:27: note: Assignment 'pType=NULL', assigned value is 0 Utilities/VisItBridge/databases/readers/SAS/avtSASFileFormat.C:500:21: note: Assuming condition is false Utilities/VisItBridge/databases/readers/SAS/avtSASFileFormat.C:516:9: note: Assuming condition is true Utilities/VisItBridge/databases/readers/SAS/avtSASFileFormat.C:520:34: note: Null pointer dereference Explanation: pType is checked against NULL right after the search loop, and the NULL case calls EXCEPTION1. In VisIt this macro throws an exception, so pType cannot be NULL at line 520. The removed inconclusive warning's path relied on the unrelated bool condition at line 516 (bReadingTemp). That condition says nothing about pType. The PR changes how bool conditions are handled in stateCoversCondition, and removing this spurious path removes a false positive. ---- 12 / 13 ---- Verdict: IMPROVEMENT (medium confidence) Package: https://ftp.debian.org/debian/pool/main/p/paraview/paraview_6.1.1+dfsg1.orig.tar.gz Result: main Utilities/VisItBridge/databases/readers/SAS/avtSASFileFormat.C:522:23: warning:inconclusive: Possible null pointer dereference: pType [nullPointer] Utilities/VisItBridge/databases/readers/SAS/avtSASFileFormat.C:498:27: note: Assignment 'pType=NULL', assigned value is 0 Utilities/VisItBridge/databases/readers/SAS/avtSASFileFormat.C:500:21: note: Assuming condition is false Utilities/VisItBridge/databases/readers/SAS/avtSASFileFormat.C:516:9: note: Assuming condition is true Utilities/VisItBridge/databases/readers/SAS/avtSASFileFormat.C:522:23: note: Null pointer dereference Explanation: `pType` is set to NULL and then assigned inside the search loop. If no match is found, `if (pType == NULL)` calls `EXCEPTION1(...)`, which in VisIt expands to a throw. So `pType` cannot be null at line 522, and the warning is a false positive. The warning's path also leans on the unrelated condition `bReadingTemp` at line 516. That fits the bug the PR fixes: `stateCoversCondition` misread the bool's impossible range (not <0, not >1) as known program state. With the fix that spurious path is gone, so a false positive was removed. ---- 13 / 13 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/p/plus42/plus42_1.5.4+ds.orig.tar.xz Result: main plus42-upstream-1.5.4/common/core_globals.cc:5046:21: warning: Possible null pointer dereference: matedit_stack [nullPointer] plus42-upstream-1.5.4/common/core_globals.cc:5032:58: note: Assuming condition 'newdepth==0' is true plus42-upstream-1.5.4/common/core_globals.cc:5032:63: note: Assignment 'newstack=newdepth==0?NULL:(matedit_stack_entry*)malloc(newdepth*sizeof(matedit_stack_entry))', assigned value is 0 plus42-upstream-1.5.4/common/core_globals.cc:5040:21: note: Assuming condition is true plus42-upstream-1.5.4/common/core_globals.cc:5044:33: note: Assignment 'matedit_stack=newstack', assigned value is 0 plus42-upstream-1.5.4/common/core_globals.cc:5046:21: note: Null pointer dereference Explanation: When newdepth==0, newstack is NULL, but matedit_stack_depth is also set to 0, so the loop `for (i = 0; i < matedit_stack_depth; i++)` never runs and matedit_stack is never dereferenced. The removed nullPointer warning was a false positive. The note 'Assuming condition is true' at line 5040 refers to the unrelated bool matedit_is_list, which is the kind of bool-range state the PR now handles more precisely.