pdf-association / pdf-issues

Industry-based resolutions for issues and errata reported against any PDF-related specification
https://pdf-issues.pdfa.org/
63 stars 2 forks source link

Several integer key values do not state explicit valid ranges #15

Open petervwyatt opened 3 years ago

petervwyatt commented 3 years ago

Several integer keys in dictionaries do not state any explicit valid ranges, such as "positive integer ..." or "non-negative integer ...".

One way to fix this quickly may be to simply state once up the front of ISO 32K somewhere (where?) that key values that represent counts, sizes, widths, heights, file byte offsets, object numbers, page numbers and <anything else that is common?> are non-negative unless stated otherwise.

Or we could review each and add the explicit wording in place.

Here is an incomplete list (from a search of ISO 32000-2 for "integer" up to about Table 100 - more to be added later):

petervwyatt commented 3 years ago

More:

petervwyatt commented 3 years ago

More:

pesco commented 2 years ago

Also Table 8: Columns (positive)?

It doesn't make any sense to allow a value of 0 here, does it? FWIW, I'll come out to admit that I managed to produce a segfault if 0 was given.

Similarly for the Columns entry in Table 11 (you wrote non-negative above)?

petervwyatt commented 2 years ago

Re Columns in Tables 8 and 11 possibly being zero: I was half thinking about the highly degenerate corner case situation where there is no data in the compressed images, in which case Columns being zero might be equally pointless/degenerate. But if we assume images always have at least 1 pixel then yes, Columns would be strictly greater than zero.

pesco commented 2 years ago

How many rows of width zero does a zero-pixel image have? Allowing Columns = 0 begs the age-old question of what is 0 divided by 0.

However, a zero-pixel image with Columns any positive integer is perfectly possible. It simply has 0 rows of that size.

(I'm assuming this data is always stored in row-major order... is it?)

petervwyatt commented 2 years ago

Yes - I believe these compressors require row-major order. As I said I only half thought about it 😀... so maybe Columns should be defined to always be strictly greater than zero.

petervwyatt commented 2 years ago

BTW based on a recent PDF TWG discussion, we will switch to avoid the use of terms such as "positive", "negative" or "non-negative" because of regional differences of interpretation as to whether each of these includes or excludes zero. We'll go with explicit wording w.r.t to zero.

petervwyatt commented 1 year ago

More:

petervwyatt commented 1 year ago

More: