Opened 21 years ago
Last modified 21 years ago
#362 closed defect (duplicate)
crash #3 reading shape file
Reported by: | Owned by: | warmerdam | |
---|---|---|---|
Priority: | highest | Milestone: | |
Component: | OGR_SF | Version: | unspecified |
Severity: | critical | Keywords: | |
Cc: |
Description
in the file /ogr/ogrsf_frmts/shape/dbfopen.c we traced a crash to the following function. We put a null check on pszValue after the DBFReadStringAttribute call and it bypassed the problem. int SHPAPI_CALL DBFIsAttributeNULL( DBFHandle psDBF, int iRecord, int iField ) { const char *pszValue = NULL; pszValue = DBFReadStringAttribute( psDBF, iRecord, iField ); // SPR Petroys NULL Check added if (pszValue == NULL) return 1; switch(psDBF->pachFieldType[iField]) { case 'N': case 'F': /* NULL numeric fields have value "****************" */ return pszValue[0] == '*'; case 'D': /* NULL date fields have value "00000000" */ return strncmp(pszValue,"00000000",8) == 0; case 'L': /* NULL boolean fields have value "?" */ return pszValue[0] == '?'; default: /* empty string fields are considered NULL */ return strlen(pszValue) == 0; } }
Change History (2)
comment:2 by , 21 years ago
This isn't exactly a dup of 360; since 360 refers to frmts/shapelib/shpopen.c, and this one to the OGR copy. However, after updates to the master (shapelib/*) I copy the code to the ogr driver directory so the update is in both places.
Note:
See TracTickets
for help on using tickets.