diff options
author | Nalluri Harikrishna <nharikrishna@nvidia.com> | 2011-09-22 11:24:50 +0530 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2011-09-22 14:38:10 -0700 |
commit | 141d7e20c914dc3dcd6fa10cd22c7fab2879a1a9 (patch) | |
tree | c6f0259776f91cc52733dfff98e5714e50d2ef2f | |
parent | fd9ca573b22ec00c2c54ab49c271485c249c234d (diff) |
xts5: XSubImage-1: Use left shift by '31' instead of 'depth' for depth >= 32
15|692 3.3-lite 1|TCM Start
400|692 1 1 20:00:19|IC Start
200|692 1 20:00:19|TP Start
520|692 1 00023801 1 1|VSW5TESTSUITE PURPOSE 1
520|692 1 00023801 1 2|Assertion XSubImage-1.(A)
520|692 1 00023801 1 3|When the rectangle specified by the x, y, subimage_width
520|692 1 00023801 1 4|and subimage_height arguments is contained in the image
520|692 1 00023801 1 5|ximage, then a call to XSubImage creates a copy of the
520|692 1 00023801 1 6|subimage and returns a pointer to the newly created
520|692 1 00023801 1 7|subimage.
520|692 1 00023801 1 8|METH: For all supported drawables types:
520|692 1 00023801 1 9|METH: Create a drawable.
520|692 1 00023801 1 10|METH: Initialise the drawable.
520|692 1 00023801 1 11|METH: For XYPixmap and ZPixmap:
520|692 1 00023801 1 12|METH: Create an image using XGetImage.
520|692 1 00023801 1 13|METH: Obtain a subimage using XSubImage.
520|692 1 00023801 1 14|METH: Verify that the pixels in the subimage are correctly set using XGetPixel.
520|692 1 00023801 1 15|unexpected signal 8 (SIGFPE) received
220|692 1 2 20:00:19|UNRESOLVED
410|692 1 1 20:00:19|IC End
This test fills pixel color values by using the function mpattern()
and checks the returned image by using the function checksubimage().
Both these functions use color values from the range 0 – 2^depth.
The value 2^depth is stored in an int (32 bit) variable by using
‘mod = 1 << depth’. If ‘depth’ is 32 then ‘mod’ ends up being 0.
This variable ‘mod’ is later used in a modulo operation resulting
in a SIGFPE. This fix corrects the test by using ‘mod = 1 << 31’
instead of 'mod = 1 << depth' for depth >= 32.
Reported-by: Nalluri Harikrishna <nharikrishna@nvidia.com>
Signed-off-by: Nalluri Harikrishna <nharikrishna@nvidia.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
-rw-r--r-- | xts5/Xlib17/XSubImage.m | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/xts5/Xlib17/XSubImage.m b/xts5/Xlib17/XSubImage.m index b4e36b00..dc73f162 100644 --- a/xts5/Xlib17/XSubImage.m +++ b/xts5/Xlib17/XSubImage.m @@ -115,11 +115,19 @@ int dep; { int i; int j; -int mod; +unsigned int mod; GC gc; unsigned long val; gc = makegc(display, d); + +/* + Since 'mod' is a 32-bit integer, 'dep>=32' will result in 'mod=0'. + Hence restrict 'dep' to 31. This does not change anything + functionally as window size is restricted to '17x19', rendering 'dep' + values greater than 6 pointless. +*/ + dep = (dep > 31) ? 31 : dep; mod = 1<<dep; for(j=0; j<h; j++) for(i=0; i<w; i++) { @@ -141,8 +149,9 @@ int i; int j; int a; int b; -int mod; +unsigned int mod; + dep = (dep > 31) ? 31 : dep; mod = 1<<dep; for(j=0, b=y; j<h; j++, b++) for(i=0, a=x; i<w; i++, a++) |