@@ -328,24 +328,33 @@ if (size > 3)
328
328
continue ;
329
329
i ++ ; /* Points to '{' */
330
330
331
- /* Loop for two values a quantifier. Offset i points to brace or comma at the
332
- start of the loop.*/
331
+ /* Loop for two values in a quantifier. Offset i points to brace or comma
332
+ at the start of the loop. */
333
333
334
334
for (int ii = 0 ; ii < 2 ; ii ++ )
335
335
{
336
336
int q = 0 ;
337
337
338
338
if (i >= size - 1 ) goto END_QSCAN ; /* Can happen for , */
339
339
340
- /* Ignore leading spaces */
340
+ /* Ignore leading spaces. */
341
341
342
342
while (wdata [i + 1 ] == ' ' || wdata [i + 1 ] == '\t' )
343
343
{
344
344
i ++ ;
345
345
if (i >= size - 1 ) goto END_QSCAN ;
346
346
}
347
347
348
- /* Scan for a number ending in brace or comma in the first iteration,
348
+ /* Ignore non-significant leading zeros. */
349
+
350
+ while (wdata [i + 1 ] == '0' && i + 2 < size && wdata [i + 2 ] >= '0' &&
351
+ wdata [i + 2 ] <= '9' )
352
+ {
353
+ i ++ ;
354
+ if (i >= size - 1 ) goto END_QSCAN ;
355
+ }
356
+
357
+ /* Scan for a number ending in brace, or comma in the first iteration,
349
358
optionally preceded by space. */
350
359
351
360
for (j = i + 1 ; j < size && j < i + 7 ; j ++ )
@@ -358,6 +367,7 @@ if (size > 3)
358
367
if (wdata [j ] != '}' && wdata [j ] != ',' ) goto OUTERLOOP ;
359
368
}
360
369
if (wdata [j ] == '}' || (ii == 0 && wdata [j ] == ',' )) break ;
370
+
361
371
if (wdata [j ] < '0' || wdata [j ] > '9' )
362
372
{
363
373
j -- ; /* Ensure this character is checked next. The */
@@ -368,8 +378,8 @@ if (size > 3)
368
378
369
379
if (j >= size ) goto END_QSCAN ; /* End of data */
370
380
371
- /* Hit ',' or '}' or read 6 digits. Six digits is a number > 65536 which is
372
- the maximum quantifier. Leave such numbers alone. */
381
+ /* Hit ',' or '}' or read 6 digits. Six digits is a number > 65536 which
382
+ is the maximum quantifier. Leave such numbers alone. */
373
383
374
384
if (j >= i + 7 || q > 65535 ) goto OUTERLOOP ;
375
385
0 commit comments