Opened 11 years ago
Closed 11 years ago
#5226 closed defect (fixed)
Off-by-one error in s57classregistrar
Reported by: | hogend | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | OGR_SF | Version: | 1.10.0 |
Severity: | normal | Keywords: | s57 |
Cc: | Kurt Schwehr |
Description
In ogr/ogrsf_frmts/s57/s57classregistrar.cpp:
#define MAX_ATTRIBUTES 65535
This is off-by-one, since IHO S-57 allows 65536 attributes. The test whether an attribute ID is valid is incorrect (line 324). iAttr is cast to an unsigned int16 so it can never be <0. Furthermore, iAttr >= nAttrMax is incorrect, since nAttrMax == 65534 Also, because of the earlier cast iAttr < 65536. This means that valid attribute IDs 65534 and 65535 are rejected! Note that, although the official registry does not contains these IDs, some chart producers use them for special purpose attributes. Patch attached.
Attachments (1)
Change History (5)
by , 11 years ago
Attachment: | gdal_s57_attributes.patch added |
---|
comment:1 by , 11 years ago
Component: | default → OGR_SF |
---|
comment:3 by , 11 years ago
Cc: | added |
---|
comment:4 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Majorly reworked attribute handling in class registrar in trunk (r26392), hopefully fixing the problem noted in this bug as well.
patch against 1.10