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 =
142142 exists ( SsaInternals0:: Def def |
143143 def .getSourceVariable ( ) .getBaseVariable ( ) .( BaseIRVariable ) .getIRVariable ( ) .getAst ( ) = p and
144144 not def .getValue ( ) .asInstruction ( ) instanceof InitializeParameterInstruction and
145- unspecifiedTypeIsModifiableAt ( p .getUnspecifiedType ( ) , indirectionIndex )
145+ underlyingTypeIsModifiableAt ( p .getUnderlyingType ( ) , indirectionIndex )
146146 )
147147 }
148148
@@ -172,11 +172,13 @@ private predicate isGlobalDefImpl(
172172 )
173173}
174174
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
177179 exists ( CppType cppType |
178- cppType .hasUnspecifiedType ( unspecified , _ ) and
179- isModifiableAt ( cppType , indirectionIndex + 1 )
180+ cppType .hasUnderlyingType ( underlying , false ) and
181+ isModifiableAt ( cppType , indirectionIndex )
180182 )
181183}
182184
Original file line number Diff line number Diff line change @@ -452,7 +452,7 @@ private module IsModifiableAtImpl {
452452 private predicate impl ( CppType cppType , int indirectionIndex ) {
453453 exists ( Type pointerType , Type base |
454454 isUnderlyingIndirectionType ( pointerType ) and
455- cppType .hasUnderlyingType ( pointerType , _ ) and
455+ cppType .hasUnderlyingType ( pointerType , false ) and
456456 base = getTypeImpl ( pointerType , indirectionIndex )
457457 |
458458 // The value cannot be modified if it has a const specifier,
You can’t perform that action at this time.
0 commit comments