Repository navigation
Conversation
Test Results 23 files 23 suites 3d 18h 59m 7s ⏱️ For more details on these failures, see this check. Results for commit 3427f9c. ♻️ 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
| memcpy(newPalette->fColorRed + 1, gRedRainbow, 12 * sizeof(UShort_t)); | ||
| memcpy(newPalette->fColorGreen + 1, gGreenRainbow, 12 * sizeof(UShort_t)); | ||
| memcpy(newPalette->fColorBlue + 1, gBlueRainbow, 12 * sizeof(UShort_t)); | ||
| memcpy(newPalette->fColorRed + 1, gRedRainbow, 10 * sizeof(UShort_t)); |
There was a problem hiding this comment.
instead of manually coding this number, which is error-prone, can we either use std::size or std::array and then .size()?
Or, at the very least, a defined constant kNRainbowElems = 10
There was a problem hiding this comment.
It is immediate bugfix of ROOT crash which I want backport to 6.40 as well.
I see many other problems here and code need to be reorganized.
See my comments to the PR description.
This can be done as separate PR then.
There was a problem hiding this comment.
It's not a big change at all to introduce...
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 |
| @@ -687,9 +687,9 @@ void TASPaletteEditor::NewPalette(Long_t id) | |||
|
|
|||
There was a problem hiding this comment.
on line 680 change to:
numPt = (id == 0 ? kNRainbowElems : 11) + 2;
Use it in assign methods Co-authored-by: ferdymercury <ferdymercury@users.noreply.github.com>
1902bb0 to
3427f9c
Compare
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 the
TASPaletteEditor::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.