Tk Source Code

Check-in [61aaaad2]
Login

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

Overview
Comment:Fix [d93d96]: Pointer arithmetic with NULL in ImgGetPhoto()
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | core-8-6-branch
Files: files | file ages | folders
SHA3-256: 61aaaad2d5fa609452ec404b3b298ea474334686388bedba054e4d8ebe6040ef
User & Date: jan.nijtmans 2025-08-15 22:12:42.846
References
2025-08-15
22:28 Closed ticket [d93d961d]: Pointer arithmetic with NULL in ImgGetPhoto() plus 7 other changes artifact: b0f491bc user: jan.nijtmans
Context
2025-08-15
22:18
version => 8.6.18 Leaf check-in: 84ea4dfd user: jan.nijtmans tags: core-8-6-branch
22:12
Fix [d93d96]: Pointer arithmetic with NULL in ImgGetPhoto() check-in: 61aaaad2 user: jan.nijtmans tags: core-8-6-branch
21:35
Fix [a91b242d43]: Correct macOSVersion on future macOS for older SDK builds check-in: f2d0ceec user: jan.nijtmans tags: core-8-6-branch
2025-08-13
13:29
Proposed fix for [d93d961dd4]: Pointer arithmetic with NULL in ImgGetPhoto() Closed-Leaf check-in: 742032a8 user: jan.nijtmans tags: bug-d93d961dd4
Changes
Unified Diff Ignore Whitespace Patch
Changes to changes.
8293
8294
8295
8296
8297
8298
8299


8300


8301
8302

2025-08-11 (bug) [dc38c9] Aqua: NSHighResolutionCapable should be a Boolean value (chavez)

2025-08-11 (bug) [4e1e10] Aqua: CGRect/NSRect type mismatch on 32-bit (root)

- Released 8.6.17, Aug 15, 2025 - https://core.tcl-lang.org/tk/ for details



2025-08-15 (bug) [a91b24] Correct macOSVersion on future macOS for older SDK builds (chavez)



- (to be) Released 8.6.18, Apr ??, 2026 - https://core.tcl-lang.org/tk/ for details







>
>

>
>


8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306

2025-08-11 (bug) [dc38c9] Aqua: NSHighResolutionCapable should be a Boolean value (chavez)

2025-08-11 (bug) [4e1e10] Aqua: CGRect/NSRect type mismatch on 32-bit (root)

- Released 8.6.17, Aug 15, 2025 - https://core.tcl-lang.org/tk/ for details

2025-08-14 (bug) [07cfc9]: Aqua: Non-menubar menu invisible if toplevel is on another display (chavez).

2025-08-15 (bug) [a91b24] Correct macOSVersion on future macOS for older SDK builds (chavez)

2025-08-15 (bug) [d93d96]: Pointer arithmetic with NULL in ImgGetPhoto() (chavez)

- (to be) Released 8.6.18, Apr ??, 2026 - https://core.tcl-lang.org/tk/ for details
Changes to generic/tkImgPhoto.c.
3791
3792
3793
3794
3795
3796
3797



3798
3799
3800
3801
3802
3803
3804
				 * the image data is returned here. */
    struct SubcommandOptions *optPtr)
{
    unsigned char *pixelPtr;
    int x, y, greenOffset, blueOffset, alphaOffset;

    Tk_PhotoGetImage((Tk_PhotoHandle) modelPtr, blockPtr);



    blockPtr->pixelPtr += optPtr->fromY * blockPtr->pitch
	    + optPtr->fromX * blockPtr->pixelSize;
    blockPtr->width = optPtr->fromX2 - optPtr->fromX;
    blockPtr->height = optPtr->fromY2 - optPtr->fromY;

    if (!(modelPtr->flags & COLOR_IMAGE) &&
	    (!(optPtr->options & OPT_BACKGROUND)







>
>
>







3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
				 * the image data is returned here. */
    struct SubcommandOptions *optPtr)
{
    unsigned char *pixelPtr;
    int x, y, greenOffset, blueOffset, alphaOffset;

    Tk_PhotoGetImage((Tk_PhotoHandle) modelPtr, blockPtr);
    if (!blockPtr->pixelPtr) {
	return NULL;
    }
    blockPtr->pixelPtr += optPtr->fromY * blockPtr->pitch
	    + optPtr->fromX * blockPtr->pixelSize;
    blockPtr->width = optPtr->fromX2 - optPtr->fromX;
    blockPtr->height = optPtr->fromY2 - optPtr->fromY;

    if (!(modelPtr->flags & COLOR_IMAGE) &&
	    (!(optPtr->options & OPT_BACKGROUND)