Tk Source Code

Changes On Branch bug-1c659ef0f1
Login

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

Changes In Branch bug-1c659ef0f1 Excluding Merge-Ins

This is equivalent to a diff from fbd051ca to d50d9faf

2017-11-25
17:24
Fix [1c659ef0f1]: 'image create photo' fails on png image containing unknown ancillary chunks check-in: 26b713d5 user: fvogel tags: core-8-6-branch
2017-11-21
21:45
Merge the bug-c89bd0aa2c branch into core-8-6-branch. check-in: 9febacc3 user: culler tags: core-8-6-branch
20:54
Pulling changes from core-8-6-branch check-in: d57bc994 user: hypnotoad tags: core_zip_vfs
20:43
Fix typo in error message Closed-Leaf check-in: d50d9faf user: fvogel tags: bug-1c659ef0f1
20:42
Fix [1c659ef0f1]: 'image create photo' fails on png image containing unknown ancillary chunks check-in: 49405d4f user: fvogel tags: bug-1c659ef0f1
20:35
Add test imgPNG-3.1 demonstrating bug [1c659ef0f1] check-in: 11438c2d user: fvogel tags: bug-1c659ef0f1
2017-11-20
09:33
merge core-8-6-branch. Also Fix [f3704d5ec8]: "Compiling on Macos High Sierra fails: missing values.h" by syncing Tcl's "tcl.m4" check-in: 4a427ebb user: jan.nijtmans tags: trunk
09:30
Fix memory leak in tkImgPhoto.c. Backported from androwish. Thanks to Christian Werner for noticing this! check-in: fbd051ca user: jan.nijtmans tags: core-8-6-branch
2017-11-19
20:50
Fix [73ba07efcd]: Use correct property type when handling MULTIPLE conversion requests. Patch from 'dpb' check-in: 23591c7d user: fvogel tags: core-8-6-branch

Changes to generic/tkImgPNG.c.

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
    0, 0, 0, 4, 0, 2, 0, 1
};

/*
 * Chunk type flags.
 */

#define PNG_CF_ANCILLARY 0x10000000L	/* Non-critical chunk (can ignore). */
#define PNG_CF_PRIVATE   0x00100000L	/* Application-specific chunk. */
#define PNG_CF_RESERVED  0x00001000L	/* Not used. */
#define PNG_CF_COPYSAFE  0x00000010L	/* Opaque data safe for copying. */

/*
 * Chunk types, not all of which have support implemented. Note that there are
 * others in the official extension set which we will never support (as they







|







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
    0, 0, 0, 4, 0, 2, 0, 1
};

/*
 * Chunk type flags.
 */

#define PNG_CF_ANCILLARY 0x20000000L	/* Non-critical chunk (can ignore). */
#define PNG_CF_PRIVATE   0x00100000L	/* Application-specific chunk. */
#define PNG_CF_RESERVED  0x00001000L	/* Not used. */
#define PNG_CF_COPYSAFE  0x00000010L	/* Opaque data safe for copying. */

/*
 * Chunk types, not all of which have support implemented. Note that there are
 * others in the official extension set which we will never support (as they
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
		if (chunkType & PNG_INT32(128,128,128,128)) {
		    /*
		     * No nice ASCII conversion; shouldn't happen either, but
		     * we'll be doubly careful.
		     */

		    Tcl_SetObjResult(interp, Tcl_NewStringObj(
			    "encountered an unsupported criticial chunk type",
			    -1));
		} else {
		    char typeString[5];

		    typeString[0] = (char) ((chunkType >> 24) & 255);
		    typeString[1] = (char) ((chunkType >> 16) & 255);
		    typeString[2] = (char) ((chunkType >> 8) & 255);
		    typeString[3] = (char) (chunkType & 255);
		    typeString[4] = '\0';
		    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
			    "encountered an unsupported criticial chunk type"
			    " \"%s\"", typeString));
		}
		Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG",
			"UNSUPPORTED_CRITICAL", NULL);
		return TCL_ERROR;
	    }








|










|







980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
		if (chunkType & PNG_INT32(128,128,128,128)) {
		    /*
		     * No nice ASCII conversion; shouldn't happen either, but
		     * we'll be doubly careful.
		     */

		    Tcl_SetObjResult(interp, Tcl_NewStringObj(
			    "encountered an unsupported critical chunk type",
			    -1));
		} else {
		    char typeString[5];

		    typeString[0] = (char) ((chunkType >> 24) & 255);
		    typeString[1] = (char) ((chunkType >> 16) & 255);
		    typeString[2] = (char) ((chunkType >> 8) & 255);
		    typeString[3] = (char) (chunkType & 255);
		    typeString[4] = '\0';
		    Tcl_SetObjResult(interp, Tcl_ObjPrintf(
			    "encountered an unsupported critical chunk type"
			    " \"%s\"", typeString));
		}
		Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG",
			"UNSUPPORTED_CRITICAL", NULL);
		return TCL_ERROR;
	    }

Added tests/iDOT.png.

cannot compute difference between binary files

Changes to tests/imgPNG.test.

1099
1100
1101
1102
1103
1104
1105











1106
1107
1108
1109
1110
1111
1112
    set i [image create photo]
} -body {
    $i put $encoded(MultiIDAT)
    return [image width $i]x[image height $i]
} -cleanup {
    image delete $i
} -result 223x212












}
namespace delete png
imageFinish
cleanupTests
return








>
>
>
>
>
>
>
>
>
>
>







1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
    set i [image create photo]
} -body {
    $i put $encoded(MultiIDAT)
    return [image width $i]x[image height $i]
} -cleanup {
    image delete $i
} -result 223x212

test imgPNG-3.1 {reading image with unknown ancillary chunk - bug [1c659ef0f1]} -setup {
    set fileName [file join [file dirname [info script]] iDOT.png]
} -body {
    # the image contains an unknown chunk iDOT
    # since the name of this chunk starts with a lowercase letter,
    # it's an ancillary chunk that shall not trigger an error
    catch {set i [image create photo -file $fileName]}
} -cleanup {
    image delete $i
} -result {0}

}
namespace delete png
imageFinish
cleanupTests
return