Jim Tcl
Check-in [9057e9319b]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:format: validate too long precision

Reported-by: Ryan Whitworth <me@ryanwhitworth.com> Signed-off-by: Steve Bennett <steveb@workware.net.au>

Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:9057e9319b77b0a8b8e76df8781990e6bd042b1b
User & Date: steveb@workware.net.au 2017-05-26 04:28:10
Context
2017-05-30
11:33
expr: Ensure that non-zero return codes are passed through

Non-zero return codes (e.g. break, continue, exit) were all being converted to the error code.

Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 6cb7cc39b3 user: steveb@workware.net.au tags: trunk

2017-05-26
04:28
format: validate too long precision

Reported-by: Ryan Whitworth <me@ryanwhitworth.com> Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 9057e9319b user: steveb@workware.net.au tags: trunk

04:27
scan: validate -ve XPG3 specifier

Reported-by: Ryan Whitworth <me@ryanwhitworth.com> Signed-off-by: Steve Bennett <steveb@workware.net.au> check-in: 557db6e98d user: steveb@workware.net.au tags: trunk

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to jim-format.c.

396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
#endif
            }

            *p++ = (char) ch;
            *p = '\0';

            /* Put some reasonable limits on the field size */
            if (width > 10000 || length > 10000) {
                Jim_SetResultString(interp, "format too long", -1);
                goto error;
            }


            /* Adjust length for width and precision */
            if (width > length) {







|







396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
#endif
            }

            *p++ = (char) ch;
            *p = '\0';

            /* Put some reasonable limits on the field size */
            if (width > 10000 || length > 10000 || precision > 10000) {
                Jim_SetResultString(interp, "format too long", -1);
                goto error;
            }


            /* Adjust length for width and precision */
            if (width > length) {

Changes to regtest.tcl.

331
332
333
334
335
336
337





338
339
340
puts "TEST 47 PASSED"

# REGTEST 48
# scan: -ve XPG3 specifier
catch {scan a {%-9999999$c}}
puts "TEST 48 PASSED"






# TAKE THE FOLLOWING puts AS LAST LINE

puts "--- ALL TESTS PASSED ---"







>
>
>
>
>



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
puts "TEST 47 PASSED"

# REGTEST 48
# scan: -ve XPG3 specifier
catch {scan a {%-9999999$c}}
puts "TEST 48 PASSED"

# REGTEST 49
# format: precision too large
catch {format %1.9999999999f 1.0}
puts "TEST 49 PASSED"

# TAKE THE FOLLOWING puts AS LAST LINE

puts "--- ALL TESTS PASSED ---"