File tree Expand file tree Collapse file tree
javascript/ql/test/library-tests/TripleDot Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import 'dummy' ;
2+
3+ class Foo {
4+ constructor ( ) {
5+ this . size = 1024 * 1024 * 4 ;
6+ this . buffer = null ;
7+ }
8+
9+ someSink ( ) {
10+ sink ( this . buffer ) ; // $ MISSING: hasTaintFlow=h1.1
11+ }
12+
13+ setData2 ( data ) {
14+ this . buffer = Buffer . from ( data ) ;
15+ }
16+
17+ setData ( ) {
18+ this . setData2 ( source ( "h1.1" ) ) ;
19+ }
20+
21+ allocate_buffers ( ) {
22+ this . buffer = new Buffer ( this . size ) ;
23+ }
24+ }
25+
26+ // Tests pass without allocate_buffers function present in the class
27+ class Baz {
28+ constructor ( ) {
29+ this . size = 1024 * 1024 * 4 ;
30+ this . buffer = null ;
31+ }
32+
33+ someSink ( ) {
34+ sink ( this . buffer ) ; // $ hasTaintFlow=h1.2
35+ }
36+
37+ setData2 ( data ) {
38+ this . buffer = Buffer . from ( data ) ;
39+ }
40+
41+ setData ( ) {
42+ this . setData2 ( source ( "h1.2" ) ) ;
43+ }
44+ }
45+
46+ // Tests pass with single setData instead of setData -> setData2
47+ class Baz {
48+ constructor ( ) {
49+ this . size = 1024 * 1024 * 4 ;
50+ this . buffer = null ;
51+ }
52+
53+ someSink ( ) {
54+ sink ( this . buffer ) ; // $ hasTaintFlow=h1.3
55+ }
56+
57+ setData ( ) {
58+ this . buffer = Buffer . from ( source ( "h1.3" ) ) ;
59+ }
60+
61+ allocate_buffers ( ) {
62+ this . buffer = new Buffer ( this . size ) ;
63+ }
64+ }
65+
66+ // Tests pass taking hardcoded value instead of class member
67+ class Foz {
68+ constructor ( ) {
69+ this . buffer = null ;
70+ }
71+
72+ someSink ( ) {
73+ sink ( this . buffer ) ; // $ hasTaintFlow=h1.1
74+ }
75+
76+ setData2 ( data ) {
77+ this . buffer = Buffer . from ( data ) ;
78+ }
79+
80+ setData ( ) {
81+ this . setData2 ( source ( "h1.1" ) ) ;
82+ }
83+
84+ allocate_buffers ( ) {
85+ this . buffer = new Buffer ( 1024 * 1024 * 4 ) ;
86+ }
87+ }
You can’t perform that action at this time.
0 commit comments