mirror of
https://github.com/github/codeql.git
synced 2026-04-26 09:15:12 +02:00
Merge pull request #18222 from github/calumgrant/bmn/badly-bounded-write
C++: Fix FPs in cpp/badly-bounded-write caused by extraction errors
This commit is contained in:
@@ -25,7 +25,8 @@ from BufferWrite bw, int destSize
|
||||
where
|
||||
bw.hasExplicitLimit() and // has an explicit size limit
|
||||
destSize = max(getBufferSize(bw.getDest(), _)) and
|
||||
bw.getExplicitLimit() > destSize // but it's larger than the destination
|
||||
bw.getExplicitLimit() > destSize and // but it's larger than the destination
|
||||
not bw.getDest().getType().stripType() instanceof ErroneousType // destSize may be incorrect
|
||||
select bw,
|
||||
"This '" + bw.getBWDesc() + "' operation is limited to " + bw.getExplicitLimit() +
|
||||
" bytes but the destination is only " + destSize + " bytes."
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* The "Badly bounded write" query (`cpp/badly-bounded-write`) no longer produces results if there is an extraction error in the type of the output buffer.
|
||||
Reference in New Issue
Block a user