summary refs log tree commit diff stats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorAndrei Formiga <archimedes_siracusa@hotmail.com>2016-05-27 19:03:15 -0300
committerAndrei Formiga <archimedes_siracusa@hotmail.com>2016-05-27 19:03:15 -0300
commitc439ef2e71f6c98aa0a9de1d2036a5422454171c (patch)
tree63334c840744169563ce39205bb14fca92d60e6c /tests/benchmarks
parent51c62a211bca12cc2f470add7bf64b0f4536d6e6 (diff)
downloadNim-c439ef2e71f6c98aa0a9de1d2036a5422454171c.tar.gz
Fix issue #4001: invalid pragma {. hint[]: off .}
The bug was in processNote, module pragmas. The code assumed that
a nkBracketExpr AST node always had two children (without testing
this), and tried to access elements with index 0 and 1 in the sons
array of the nkBracketExpr node.

The code that triggered the bug was just {. hint[]: off .}
by itself in a module; in this case the nkBracketExpr has only
one children in the sons array, so the code in processNote caused
an out-of-bounds array access.

This commit also adds a test to guarantee that this pragma is
rejected, as is.
Diffstat (limited to 'tests/benchmarks')
0 files changed, 0 insertions, 0 deletions
1 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236