File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
ruby/ql/lib/codeql/ruby/dataflow Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -32,12 +32,18 @@ module SummaryComponent {
32
32
/** Gets a summary component that represents an element in an array at an unknown index. */
33
33
SummaryComponent arrayElementUnknown ( ) { result = SC:: content ( TUnknownArrayElementContent ( ) ) }
34
34
35
- /** Gets a summary component that represents an element in an array at a known index. */
35
+ /**
36
+ * Gets a summary component that represents an element in an array at a known index.
37
+ *
38
+ * Has no result for negative indices. Wrap-around interpretation of negative indices should be
39
+ * handled by the caller, if modeling a function that has such behavior.
40
+ */
36
41
bindingset [ i]
37
42
SummaryComponent arrayElementKnown ( int i ) {
38
43
result = SC:: content ( TKnownArrayElementContent ( i ) )
39
44
or
40
45
// `i` may be out of range
46
+ i >= 0 and
41
47
not exists ( TKnownArrayElementContent ( i ) ) and
42
48
result = arrayElementUnknown ( )
43
49
}
You can’t perform that action at this time.
0 commit comments