File tree 3 files changed +16
-1
lines changed
lib/semmle/javascript/dataflow/internal
3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -255,7 +255,10 @@ module Public {
255
255
Content asSingleton ( ) { this = MkSingletonContent ( result ) }
256
256
257
257
/** Gets the property name to be accessed. */
258
- PropertyName asPropertyName ( ) { result = this .asSingleton ( ) .asPropertyName ( ) }
258
+ PropertyName asPropertyName ( ) {
259
+ // TODO: array indices should be mapped to a ContentSet that also reads from UnknownArrayElement
260
+ result = this .asSingleton ( ) .asPropertyName ( )
261
+ }
259
262
260
263
/** Gets the array index to be accessed. */
261
264
int asArrayIndex ( ) { result = this .asSingleton ( ) .asArrayIndex ( ) }
Original file line number Diff line number Diff line change 51
51
| array-mutation.js:31:33:31:40 | source() | array-mutation.js:32:8:32:8 | h |
52
52
| array-mutation.js:35:36:35:43 | source() | array-mutation.js:36:8:36:8 | i |
53
53
| array-mutation.js:39:17:39:24 | source() | array-mutation.js:40:8:40:8 | j |
54
+ | array-mutation.js:43:10:43:17 | source() | array-mutation.js:44:8:44:11 | k[0] |
55
+ | array-mutation.js:43:10:43:17 | source() | array-mutation.js:45:8:45:11 | k[1] |
56
+ | array-mutation.js:43:10:43:17 | source() | array-mutation.js:46:8:46:11 | k[2] |
54
57
| arrays-init.js:2:16:2:23 | source() | arrays-init.js:17:8:17:13 | arr[1] |
55
58
| arrays-init.js:2:16:2:23 | source() | arrays-init.js:22:8:22:13 | arr[6] |
56
59
| arrays-init.js:2:16:2:23 | source() | arrays-init.js:28:8:28:13 | arr[1] |
Original file line number Diff line number Diff line change @@ -163,3 +163,12 @@ function t15() {
163
163
args . push ( source ( 't15.1' ) ) ;
164
164
target ( 'safe' , ...args ) ;
165
165
}
166
+
167
+ function t16 ( ) {
168
+ let array = new Array ( Math . floor ( Math . random ( ) * 10 ) )
169
+ array . push ( source ( "t16.1" ) ) ;
170
+ sink ( array [ 0 ] ) ; // $ MISSING: hasValueFlow=t16.1 SPURIOUS: hasTaintFlow=t16.1
171
+ sink ( array [ 1 ] ) ; // $ MISSING: hasValueFlow=t16.1 SPURIOUS: hasTaintFlow=t16.1
172
+ sink ( array [ 2 ] ) ; // $ MISSING: hasValueFlow=t16.1 SPURIOUS: hasTaintFlow=t16.1
173
+ sink ( array ) ; // $ hasTaintFlow=t16.1
174
+ }
You can’t perform that action at this time.
0 commit comments