mirror of
https://github.com/github/codeql.git
synced 2025-12-24 12:46:34 +01:00
stash: change sinks to zip handles and sources to the zip handle initializers
This commit is contained in:
@@ -21,6 +21,7 @@ import semmle.code.cpp.security.FlowSources
|
||||
private class PointerVar extends VariableAccess {
|
||||
PointerVar() { this.getType() instanceof PointerType }
|
||||
}
|
||||
|
||||
/**
|
||||
* A unsigned char Variable is used in Flow source
|
||||
*/
|
||||
@@ -56,6 +57,18 @@ private class MzUncompress extends Function {
|
||||
MzUncompress() { this.hasGlobalName(["uncompress", "mz_uncompress", "mz_uncompress2"]) }
|
||||
}
|
||||
|
||||
/**
|
||||
* A `zip handle` is used in Flow source
|
||||
*/
|
||||
private class MzZip extends Function {
|
||||
MzZip() {
|
||||
this.hasGlobalName([
|
||||
"mz_zip_reader_open", "mz_zip_reader_open_file", "mz_zip_reader_open_file_in_memory",
|
||||
"mz_zip_reader_open_buffer", "mz_zip_reader_entry_open"
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The `mz_inflate` functions are used in Flow Sink
|
||||
*/
|
||||
@@ -138,6 +151,9 @@ module MinizTaintConfig implements DataFlow::StateConfigSig {
|
||||
source.asDefiningArgument() =
|
||||
any(Call call | call.getTarget() instanceof MzInflateInit).getArgument(0) and
|
||||
state = "inflate"
|
||||
or
|
||||
source.asDefiningArgument() = any(Call call | call.getTarget() instanceof MzZip).getArgument(0) and
|
||||
state = ""
|
||||
}
|
||||
|
||||
predicate isSink(DataFlow::Node sink, DataFlow::FlowState state) {
|
||||
|
||||
Reference in New Issue
Block a user