Tcl Source Code

Check-in [862ead931b]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:Bug fix: Assembler dereferences a rogue pointer when unstacking an empty exception range.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | bug-3154ea2759
Files: files | file ages | folders
SHA1: 862ead931b2e715d01ad624ebcc0a7817c892b45
User & Date: kbk 2016-05-13 00:46:23
Context
2016-05-13
08:01
Merge core-8-6-branch. Eliminate some unnecessary spacing. check-in: e7796bf5e8 user: jan.nijtmans tags: trunk
00:46
Bug fix: Assembler dereferences a rogue pointer when unstacking an empty exception range. check-in: 862ead931b user: kbk tags: trunk, bug-3154ea2759
00:45
Bug fix: Assembler dereferences a rogue pointer when unstacking an empty exception range. check-in: 665d72dc7b user: kbk tags: core-8-6-branch, bug-3154ea2759
2016-05-10
16:52
Value correctness over performance myths. Encoding ObjType duplication needs to dup the typePtr so t... check-in: 462af0ad86 user: dgp tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclAssembly.c.

3978
3979
3980
3981
3982
3983
3984

3985
3986
3987
3988

3989
3990
3991
3992
3993
3994
3995
    /*
     * Unstack any catches that are deeper than the nesting level of the basic
     * block being entered.
     */

    while (catchDepth > bbPtr->catchDepth) {
	--catchDepth;

	range = envPtr->exceptArrayPtr + catchIndices[catchDepth];
	range->numCodeBytes = bbPtr->startOffset - range->codeOffset;
	catches[catchDepth] = NULL;
	catchIndices[catchDepth] = -1;

    }

    /*
     * Unstack any catches that don't match the basic block being entered,
     * either because they are no longer part of the context, or because the
     * context has changed from INCATCH to CAUGHT.
     */






>
|
|
|
|
>







3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
    /*
     * Unstack any catches that are deeper than the nesting level of the basic
     * block being entered.
     */

    while (catchDepth > bbPtr->catchDepth) {
	--catchDepth;
	if (catches[catchDepth] != NULL) {
	    range = envPtr->exceptArrayPtr + catchIndices[catchDepth];
	    range->numCodeBytes = bbPtr->startOffset - range->codeOffset;
	    catches[catchDepth] = NULL;
	    catchIndices[catchDepth] = -1;
	}
    }

    /*
     * Unstack any catches that don't match the basic block being entered,
     * either because they are no longer part of the context, or because the
     * context has changed from INCATCH to CAUGHT.
     */

Changes to tests/assemble.test.

3275
3276
3277
3278
3279
3280
3281





















































































3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
	catch {
	    apply {{} {
		assemble {reverse polish notation}
	    }}
	}
    }
} 0





















































































 
rename fillTables {}
rename assemble {}

::tcltest::cleanupTests
return

# Local Variables:
# mode: tcl
# fill-column: 78
# End:






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>











3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
	catch {
	    apply {{} {
		assemble {reverse polish notation}
	    }}
	}
    }
} 0

test assemble-52.1 {Bug 3154ea2759} {
    proc __BEGIN {} {
	::tcl::unsupported::assemble {
	    beginCatch @badLabel
	    push error
	    push testing
	    invokeStk 2
	    pop
	    push 0
	    jump @okLabel
	    label @badLabel
	    push 1; # should be pushReturnCode
	    label @okLabel
	    endCatch
	    pop
	    
	    beginCatch @badLabel2
	    push error
	    push testing
	    invokeStk 2
	    pop
	    push 0
	    jump @okLabel2
	    label @badLabel2
	    push 1; # should be pushReturnCode
	    label @okLabel2
	    endCatch
	    pop
	    
	    beginCatch @badLabel3
	    push error
	    push testing
	    invokeStk 2
	    pop
	    push 0
	    jump @okLabel3
	    label @badLabel3
	    push 1; # should be pushReturnCode
	    label @okLabel3
	    endCatch
	    pop
	    
	    beginCatch @badLabel4
	    push error
	    push testing
	    invokeStk 2
	    pop
	    push 0
	    jump @okLabel4
	    label @badLabel4
	    push 1; # should be pushReturnCode
	    label @okLabel4
	    endCatch
	    pop
	    
	    beginCatch @badLabel5
	    push error
	    push testing
	    invokeStk 2
	    pop
	    push 0
	    jump @okLabel5
	    label @badLabel5
	    push 1; # should be pushReturnCode
	    label @okLabel5
	    endCatch
	    pop
	    
	    beginCatch @badLabel6
	    push error
	    push testing
	    invokeStk 2
	    pop
	    push 0
	    jump @okLabel6
	    label @badLabel6
	    push 1; # should be pushReturnCode
	    label @okLabel6
	    endCatch
	    pop
	}
    }
    __BEGIN
} {};				# must not crash
 
rename fillTables {}
rename assemble {}

::tcltest::cleanupTests
return

# Local Variables:
# mode: tcl
# fill-column: 78
# End: