Apply suggestions from code review

Co-authored-by: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
This commit is contained in:
Slavomir
2020-07-01 12:16:40 +03:00
committed by GitHub
parent 87c2ac3caf
commit 62ccceb543
2 changed files with 3 additions and 3 deletions

View File

@@ -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>

View File

@@ -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