| Ticket UUID: | 3078902 | |||
| Title: | TK library goes into an infinite loop | |||
| Type: | Bug | Version: | obsolete: 8.6b1.1 | |
| Submitter: | cmandachescu | Created on: | 2010-09-30 18:05:44 | |
| Subsystem: | 41. Photo Images | Assigned To: | dkf | |
| Priority: | 5 Medium | Severity: | ||
| Status: | Closed | Last Modified: | 2010-10-01 19:06:31 | |
| Resolution: | Fixed | Closed By: | dkf | |
| Closed on: | 2010-10-01 12:06:31 | |||
| Description: |
The tk library goes into an infinite loop in the file generic/tkImgPhoto.c in function Tk_PhotoPutBlock in the following code:
/*
* Copy and merge pixels according to the compositing rule.
*/
for (hLeft = height; hLeft > 0;) {
int pixelSize = blockPtr->pixelSize;
int compRuleSet = (compRule == TK_PHOTO_COMPOSITE_SET);
srcLinePtr = blockPtr->pixelPtr + blockPtr->offset[0];
hCopy = MIN(hLeft, blockPtr->height);
hLeft -= hCopy;
for (; hCopy > 0; --hCopy) {
.....
}
}
The problem shows up when (for some yet unknown reason, the blockPtr->height is 0.
In that case, hCopy becomes 0 and the loop counter hLeft never gets decremented.
I have fixed this problem in the library I use by placing the following code after the line
hCopy = MIN(hLeft, blockPtr->height);
if(hCopy < 1) {
break;
}
| |||
| User Comments: |
dkf added on 2010-10-01 19:06:31:
allow_comments - 1 dkf added on 2010-10-01 19:06:30: Nothing should happen when the block is either zero-width or zero-height. (Either that or things should panic because this is a PEBCAK.) Fixed in HEAD; "don't do that" in previous versions. | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki