diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2015-06-23 11:29:39 +0100 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2015-06-23 11:29:39 +0100 |
commit | 3fd5c000705d844ae609945ae82260ccdff58896 (patch) | |
tree | 9d3895d51ce5b650ca73c17f7e2086a732851097 | |
parent | 352a75aaba6804eab50b49e6c574365a83e37c47 (diff) | |
download | ghostpdl-3fd5c000705d844ae609945ae82260ccdff58896.tar.gz |
Coverity ID #94854, 94855, 94871, 94928 avoid potential array overrun
by using '>=' instead of '>'. In practice this can't happen, because the
enum value 'NUM_RESOURCe_TYPES' isn't used to create or address any actual
resources.
-rw-r--r-- | gs/devices/vector/gdevpdfu.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gs/devices/vector/gdevpdfu.c b/gs/devices/vector/gdevpdfu.c index d9deb173a..c0186f89a 100644 --- a/gs/devices/vector/gdevpdfu.c +++ b/gs/devices/vector/gdevpdfu.c @@ -1161,7 +1161,7 @@ pdf_cancel_resource(gx_device_pdf * pdev, pdf_resource_t *pres, pdf_resource_typ if (pres->object) { pres->object->written = true; if (rtype == resourceXObject || rtype == resourceCharProc || rtype == resourceOther - || rtype > NUM_RESOURCE_TYPES) { + || rtype >= NUM_RESOURCE_TYPES) { int code = cos_stream_release_pieces((cos_stream_t *)pres->object); if (code < 0) @@ -1473,7 +1473,7 @@ pdf_begin_resource_body(gx_device_pdf * pdev, pdf_resource_type_t rtype, { int code; - if (rtype > NUM_RESOURCE_TYPES) + if (rtype >= NUM_RESOURCE_TYPES) rtype = resourceOther; code = pdf_begin_aside(pdev, PDF_RESOURCE_CHAIN(pdev, rtype, rid), @@ -1489,7 +1489,7 @@ pdf_begin_resource(gx_device_pdf * pdev, pdf_resource_type_t rtype, gs_id rid, { int code; - if (rtype > NUM_RESOURCE_TYPES) + if (rtype >= NUM_RESOURCE_TYPES) rtype = resourceOther; code = pdf_begin_resource_body(pdev, rtype, rid, ppres); @@ -1521,7 +1521,7 @@ pdf_alloc_resource(gx_device_pdf * pdev, pdf_resource_type_t rtype, gs_id rid, { int code; - if (rtype > NUM_RESOURCE_TYPES) + if (rtype >= NUM_RESOURCE_TYPES) rtype = resourceOther; code = pdf_alloc_aside(pdev, PDF_RESOURCE_CHAIN(pdev, rtype, rid), @@ -1653,7 +1653,7 @@ pdf_store_page_resources(gx_device_pdf *pdev, pdf_page_t *page, bool clear_usage stream *s = 0; int j; - if (i == resourceOther || i > NUM_RESOURCE_TYPES) + if (i == resourceOther || i >= NUM_RESOURCE_TYPES) continue; page->resource_ids[i] = 0; for (j = 0; j < NUM_RESOURCE_CHAINS; ++j) { |