[Gdal-dev] Errors in dgnread.cpp

Steve Brooks sbrooks2 at kc.rr.com
Sat Sep 20 13:57:38 EDT 2003


I have found two fatal errors in dgnread.cpp the first one will cause a
crash
when there appears to be attributes on the tcb which inside the 'if'  
psElement->attr_bytes gets setup as a negative number which causes the
CPLMalloc to crash.  If you would like a copy of the dgn file let me know.
My fix was not to go inside the if( psElement->properties & DGNPF_ATTRIBUTES
)
if the element is a tcb.
 
The next change was causing OGRLayer::GetFeature
to not return any features.  When the DGN Index was being built the
offset was being truncated to an invalid offest by the (unsigned char)
cast.
 
My envionment is Windows XP, Microsoft Visual Studio.Net 2003.
 
 
Thanks
Steve Brooks
 
 
----------------------------------------------------------------------------
-----------------------
$ diff clean/dgnread.cpp modified/dgnread.cpp
1093c1093
< if( psElement->properties & DGNPF_ATTRIBUTES )
---
> if( psElement->properties & DGNPF_ATTRIBUTES && psElement->type !=
DGNT_TCB )
1621c1621
< psEI->offset = (unsigned char) nLastOffset;
---
> psEI->offset = (long) nLastOffset;
 
----------------------------------------------------------------------------
---------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20030920/72274a0d/attachment.html


More information about the Gdal-dev mailing list