Repository navigation
[asimage] fix bug in rainbow palette selection - #23725
Conversation
Test Results 24 files 24 suites 4d 0h 21m 8s ⏱️ For more details on these failures, see this check. Results for commit bc637f0. ♻️ This comment has been updated with latest results. |
ferdymercury
left a comment
There was a problem hiding this comment.
all palettes seem to start at [1], see for example
case 1: // gray
for (pt = 1; pt < Int_t(numPt - 1); pt++) {
Would it make more sense to instead copy one element less but still start at 1, for consistency?
Or to make the others below also start at 0?
|
Thanks for remark! |
Target array has only 12 elements, but rainbow palette has only 10 points These 10 points should be copied from offset 1, first and last point will be overwritten
a7f1a3d to
20f467a
Compare
For kGray palette, the loop end condition is
so the TPalette for gray has 13 elements, first and last elements are reserved, second is 0 and second-last is 65535, and the rest is linearly increasing inbetween Where did you see the overflow issue? |
There are too many |
Use it in assign methods Co-authored-by: ferdymercury <ferdymercury@users.noreply.github.com>
1902bb0 to
3427f9c
Compare
New kNRainbowElems constant specify number of elements in array, palette should reserve 2 more points
|
/backport to 6.40 |
|
Preparing to backport PR #23725 to branch 6.40 requested by linev |
|
This PR has been backported to branch 6.40: #23771 |
Predefined rainbow palette has only 10 points, but 12 were copied - overwriting memory outside allocated region.
Failure can be observed with
tutorials/visualisation/image/galaxy_image.Ctrying to select "Rainbow" palette in combobox.@ferdymercury
Code in theTASPaletteEditor::NewPalette()method must be reviewed.I see a lot of arithmetic like
0xffff * (pt - 1) / (numPt - 3);which leads to overflow of last calculated point.