summaryrefslogtreecommitdiff
path: root/gs/contrib
diff options
context:
space:
mode:
authorAlex Cherepanov <alex.cherepanov@artifex.com>2009-12-08 03:33:05 +0000
committerAlex Cherepanov <alex.cherepanov@artifex.com>2009-12-08 03:33:05 +0000
commit528bf4bb3694a0d07e2c67d3c1afe98bb7b4e36a (patch)
treed0cf7436eeeacdb912d192caf7b88cd515aaa594 /gs/contrib
parentf3d39f21cc3fed925974e1593948714867e6e30e (diff)
Fix Coverity warnings caused by a recurring error in opvp driver where
'if (i > sizeof(foo)/sizeof(*foo)) ...' was used to prevent out-of-bounds access to foo[i] . git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@10462 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'gs/contrib')
-rw-r--r--gs/contrib/opvp/gdevopvp.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/gs/contrib/opvp/gdevopvp.c b/gs/contrib/opvp/gdevopvp.c
index 5b28d5fa8..c391f90a9 100644
--- a/gs/contrib/opvp/gdevopvp.c
+++ b/gs/contrib/opvp/gdevopvp.c
@@ -609,7 +609,7 @@ QueryColorSpaceWrapper( opvp_dc_t printerContext, opvp_int_t *pnum,
/* translate cspaces */
for (i = 0;i < *pnum;i++) {
if (pcspace[i]
- > sizeof(cspace_0_2_to_1_0)/sizeof(opvp_cspace_t)) {
+ >= sizeof(cspace_0_2_to_1_0)/sizeof(opvp_cspace_t)) {
/* unknown color space */
/* set DEVICERGB instead */
pcspace[i] = OPVP_CSPACE_DEVICERGB;
@@ -629,7 +629,7 @@ SetColorSpaceWrapper(opvp_dc_t printerContext, opvp_cspace_t cspace)
return -1;
}
if (cspace
- > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
+ >= sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
/* unknown color space */
*ErrorNo = OPVP_PARAMERROR_0_2;
return -1;
@@ -649,7 +649,7 @@ GetColorSpaceWrapper(opvp_dc_t printerContext, opvp_cspace_t *pcspace)
return r;
}
if (*pcspace
- > sizeof(cspace_0_2_to_1_0)/sizeof(opvp_cspace_t)) {
+ >= sizeof(cspace_0_2_to_1_0)/sizeof(opvp_cspace_t)) {
/* unknown color space */
/* set DEVICERGB instead */
*pcspace = OPVP_CSPACE_DEVICERGB;
@@ -673,7 +673,7 @@ SetStrokeColorWrapper(opvp_dc_t printerContext, const opvp_brush_t *brush)
return OPVP_NOTSUPPORTED;
}
if (brush->colorSpace
- > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
+ >= sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
/* unknown color space */
*ErrorNo = OPVP_PARAMERROR_0_2;
return -1;
@@ -700,7 +700,7 @@ SetFillColorWrapper(opvp_dc_t printerContext, const opvp_brush_t *brush)
return OPVP_NOTSUPPORTED;
}
if (brush->colorSpace
- > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
+ >= sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
/* unknown color space */
*ErrorNo = OPVP_PARAMERROR_0_2;
return -1;
@@ -728,7 +728,7 @@ SetBgColorWrapper(opvp_dc_t printerContext, const opvp_brush_t *brush)
return -1;
}
if (brush->colorSpace
- > sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
+ >= sizeof(cspace_1_0_to_0_2)/sizeof(OPVP_ColorSpace)) {
/* unknown color space */
*ErrorNo = OPVP_PARAMERROR_0_2;
return -1;
@@ -787,7 +787,7 @@ DrawImageWrapper(
OPVP_I2FIX(0,rect.p0.y);
OPVP_I2FIX(destinationWidth,rect.p1.x);
OPVP_I2FIX(destinationHeight,rect.p1.y);
- if (imageFormat > sizeof(iformat_1_0_to_0_2)/sizeof(OPVP_ImageFormat)) {
+ if (imageFormat >= sizeof(iformat_1_0_to_0_2)/sizeof(OPVP_ImageFormat)) {
/* illegal image format */
*ErrorNo = OPVP_PARAMERROR_0_2;
return -1;
@@ -848,7 +848,7 @@ StartDrawImageWrapper(
OPVP_I2FIX(0,rect.p0.y);
OPVP_I2FIX(destinationWidth,rect.p1.x);
OPVP_I2FIX(destinationHeight,rect.p1.y);
- if (imageFormat > sizeof(iformat_1_0_to_0_2)/sizeof(OPVP_ImageFormat)) {
+ if (imageFormat >= sizeof(iformat_1_0_to_0_2)/sizeof(OPVP_ImageFormat)) {
/* illegal image format */
*ErrorNo = OPVP_PARAMERROR_0_2;
return -1;