File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ private newtype TDefOrUseImpl =
142
142
exists ( SsaInternals0:: Def def |
143
143
def .getSourceVariable ( ) .getBaseVariable ( ) .( BaseIRVariable ) .getIRVariable ( ) .getAst ( ) = p and
144
144
not def .getValue ( ) .asInstruction ( ) instanceof InitializeParameterInstruction and
145
- unspecifiedTypeIsModifiableAt ( p .getUnspecifiedType ( ) , indirectionIndex )
145
+ underlyingTypeIsModifiableAt ( p .getUnderlyingType ( ) , indirectionIndex )
146
146
)
147
147
}
148
148
@@ -172,11 +172,13 @@ private predicate isGlobalDefImpl(
172
172
)
173
173
}
174
174
175
- private predicate unspecifiedTypeIsModifiableAt ( Type unspecified , int indirectionIndex ) {
176
- indirectionIndex = [ 1 .. getIndirectionForUnspecifiedType ( unspecified ) .getNumberOfIndirections ( ) ] and
175
+ private predicate underlyingTypeIsModifiableAt ( Type underlying , int indirectionIndex ) {
176
+ indirectionIndex =
177
+ [ 1 .. getIndirectionForUnspecifiedType ( underlying .getUnspecifiedType ( ) )
178
+ .getNumberOfIndirections ( ) ] and
177
179
exists ( CppType cppType |
178
- cppType .hasUnspecifiedType ( unspecified , _ ) and
179
- isModifiableAt ( cppType , indirectionIndex + 1 )
180
+ cppType .hasUnderlyingType ( underlying , false ) and
181
+ isModifiableAt ( cppType , indirectionIndex )
180
182
)
181
183
}
182
184
Original file line number Diff line number Diff line change @@ -452,7 +452,7 @@ private module IsModifiableAtImpl {
452
452
private predicate impl ( CppType cppType , int indirectionIndex ) {
453
453
exists ( Type pointerType , Type base |
454
454
isUnderlyingIndirectionType ( pointerType ) and
455
- cppType .hasUnderlyingType ( pointerType , _ ) and
455
+ cppType .hasUnderlyingType ( pointerType , false ) and
456
456
base = getTypeImpl ( pointerType , indirectionIndex )
457
457
|
458
458
// The value cannot be modified if it has a const specifier,
You can’t perform that action at this time.
0 commit comments