#2109 closed defect (invalid)
Mapserver/Mapscript Crashes when rendering an empty OGR layer.
Reported by: | plasmab | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | OGR Support | Version: | 5.0 |
Severity: | major | Keywords: | ogr |
Cc: | dmorissette |
Description
SVN Checkout of mapserver/mapscript(php) crashes when rendering an empty OGR layer.
Attachments (1)
Change History (12)
comment:1 by , 17 years ago
comment:2 by , 17 years ago
Note that the way the code works a the moment the feature count check is after the first getnextfeature
comment:3 by , 17 years ago
Additional: GDAL/OGR/Mapserver versions that worked with the empty layer. (Requested by FrankW)
Previous mapserver version 4.4.2 Previous ogr/gdal version 1.2.6
comment:4 by , 17 years ago
The code checks the feature count. But it does the zero check after it tries to pull the first feature. (mapogr.cpp)
comment:6 by , 17 years ago
Cc: | added |
---|---|
Status: | new → assigned |
Stephen,
I tried to reproduce a problem with mapserver-svn (and mapserver 4.10 branch) shp2img on a simple mapfile with an ogr layer that has no features. The shp2img seemed to run without any problem.
I also reviewed the code and I don't see any obvious problem. Could you prepare a sample - preferrably a shp2img command + mapfile + data or even a PHP script+map+data to demonstrate the problem?
I reviewed the recent mapogr.cpp history and I don't see any change likely to have fixed this.
I'm adding DanielM as a cc: since I think he is working on a C conversion of mapogr.cpp and will need to be aware of changes.
comment:7 by , 16 years ago
Milestone: | 4.10.3 release → 5.0.1 release |
---|---|
Priority: | highest → normal |
Stephen,
I'm still waiting for details to reproduce this. I'm moving it on to 5.0.1 as a target.
comment:8 by , 16 years ago
Resolution: | → worksforme |
---|---|
Status: | assigned → closed |
Plasmab,
I'm closing this since I can't reproduce it, and you haven't provided additional supporting info.
Please reopen if you can help me reproduce it.
comment:9 by , 16 years ago
Component: | MapScript-PHP → OGR Support |
---|---|
Resolution: | worksforme |
Status: | closed → reopened |
Version: | 4.10 → 5.0 |
Hi,
I reopen the bug because I have always the same problem with empty MapInfo files.
shp2img returns the following error :
msDrawMap(): Image handling error. Failed to draw layer named 'empty_layer'. msOGRFileNextShape(): OGR error. InitBlockFromData(): Invalid Block Type: got 0 expected 2
I work with Mapserver 5.0.2 and gdla/ogr 1.4.2. I also attached an example with an empty MapInfo file and a mapfile.
comment:10 by , 14 years ago
Milestone: | 5.0.1 release |
---|---|
Resolution: | → invalid |
Status: | reopened → closed |
I have confirmed this problem and it appears to be an MITAB issue with empty TAB files, and having a spatial query active. MITAB issues a CPLError and then continues normally. MapServer is always has a spatial query in place, and mapogr.cpp is sensitive to issued CPLErrors since it tests GetLastError if NULL is returned by GetNextFeature().
I think MITAB needs is likely issuing an error when it is not necessary for empty TAB files.
I have filed this in the MITAB bugzilla as:
I do not believe any action is required in MapServer so I am closing this ticket. Sorry for the delay in followup analysis. I only ended up back here because I was wondering what to do with the test map I had originally prepared to test this issue. :-)
comment:11 by , 14 years ago
For the record, this bug has been fixed in mitab, see http://bugzilla.maptools.org/show_bug.cgi?id=2136
This bug is caused by this change.
mapogr.cpp line 1270... a check should be made somewhere here to see if a layer has any features if not MS_DONE should be returned.
Stephen