mirror of
https://github.com/github/codeql.git
synced 2026-01-29 14:23:03 +01:00
Apply suggestions from code review
Co-authored-by: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<overview>
|
||||
<p>
|
||||
The package `unsafe` provides operations that step outside the type safety
|
||||
guarantees normally provided inside Golang programs. This leaves room for
|
||||
guarantees normally provided inside Go programs. This leaves room for
|
||||
errors in the usage of the `unsafe` package that are not caught by the compiler.
|
||||
</p>
|
||||
<p>
|
||||
@@ -16,7 +16,7 @@
|
||||
</overview>
|
||||
<recommendation>
|
||||
<p>
|
||||
The basic recomendation is to avoid usage of the package `unsafe`. If that is
|
||||
The basic recommendation is to avoid usage of the package `unsafe`. If that is
|
||||
not an option, you should always check the size of types you cast your data
|
||||
to/from to make sure they won't result in reading outside of the intended bounds.
|
||||
</p>
|
||||
|
||||
@@ -105,7 +105,7 @@ predicate castTypeToArray(DataFlow::PathNode source, DataFlow::PathNode sink, st
|
||||
cfg.isSource(source.getNode(), castLittle) and
|
||||
cfg.isSink(sink.getNode(), castBig) and
|
||||
arrTo = getFinalType(castBig.getTypeExpr().getType()) and
|
||||
not (typeFrom instanceof ArrayType or typeFrom.getUnderlyingType() instanceof ArrayType) and
|
||||
not typeFrom.getUnderlyingType() instanceof ArrayType and
|
||||
not typeFrom instanceof PointerType and
|
||||
not castLittle.getOperand().getChildExpr(0).(IndexExpr).getBase().getType() instanceof ArrayType and
|
||||
typeFrom = getFinalType(castLittle.getOperand().getType()) and
|
||||
|
||||
Reference in New Issue
Block a user