Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#4949 closed defect (fixed)

S57ClassRegistrar::FindAttrByAcronym return type should be GUInt16 to support the Inland_waterways S57_PROFILE

Reported by: julius6 Owned by: warmerdam
Priority: normal Milestone: 1.9.3
Component: OGR_SF Version: 1.9.2
Severity: normal Keywords:
Cc:

Description

When using the Inland_waterways S57_PROFILE and consequently s57attributes_iw.csv, attributes might exist with "Code" > 32767. To cope with this, the signature of the S57ClassRegistrar::FindAttrByAcronym member function should be changed from:

GInt16      FindAttrByAcronym( const char * );

to:

GUInt16      FindAttrByAcronym( const char * );

When GInt16 is used, an access violation error, more in detail an out-of-bound access in the panAttrIndex array, happens in s57featuredefns.cpp, function S57GenerateObjectClassDefn, line 399:

switch( poCR->GetAttrType( iAttrIndex ) )

Environment: Windows XP SP3, MSVC2008 SP1

Change History (2)

comment:1 by Even Rouault, 11 years ago

Milestone: 1.9.3
Resolution: fixed
Status: newclosed

Fixned in trunk (r25501) and branches/1.9 (r25502)

I've fixed it differently by returning a int, since -1 can be returned in case there's no match. I just compile-tested it though, so please report if it doesn't work for you

comment:2 by julius6, 11 years ago

The fix works for me. Thanks

Note: See TracTickets for help on using tickets.