MapServer / MapServer-import

3 stars 2 forks source link

[WMS Server] Crash when using wms_style* metadata #1096

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: jmckenna@dmsolutions.ca Date: 2004/11/29 - 21:49

I am documenting the changes implemented in bug#944.

When trying the new wms_style metadata for LegendURL (with mapserv 4.4-beta3), I
cannot generate a warning, and if I try to correctly specify the new metadata my
mapserv.exe crashes.

here is an example layer that should work:

LAYER
  NAME land_fn
  METADATA
    "wms_title"  "Foreign Lands"
    "wms_style" "test" 
    "wms_style_test_legendurl_width" "72"    
    "wms_style_test_legendurl_legend" "72"  
    "wms_style_test_legendurl_format" "image/gif"
    "wms_style_test_legendurl_href" "http://wwww.rrr.com"
  END
  ...
tbonfort commented 12 years ago

Author: jmckenna@dmsolutions.ca Date: 2004/11/29 - 21:54

mapserv crashes on a GetCapabilities request
tbonfort commented 12 years ago

Author: dmorissette Date: 2004/11/29 - 22:02

This happens because of poor management of the pszMetadataName in msDumpLayer()
when writing the legendURl coming from metadata. Cleaning this up now.
tbonfort commented 12 years ago

Author: dmorissette Date: 2004/11/29 - 22:12

Important: to reproduce this, use VERSION=>1.1.0, e.g.

http://sb1/cgi-bin/mapserv_44?map=/path/to/my.map&version=1.1.1&request=getcapabilities
tbonfort commented 12 years ago

Author: dmorissette Date: 2004/11/29 - 22:40

Fixed in 4.4.0

The problem was a stray msFree(pszMetadataName) in msDumpLayer() in mapwms.c.
Removing the extra msFree() fixed the crash. I also removed all other msFree()
calls for that variable and kept a single one at the end of the function.
tbonfort commented 12 years ago

Author: dmorissette Date: 2004/11/29 - 22:53

BTW Jeff, in case you didn't notice already, in your example there was a typo in
the height metadata, it should be:
    "wms_style_test_legendurl_height" "72"  
tbonfort commented 12 years ago

Author: jmckenna@dmsolutions.ca Date: 2004/11/30 - 02:28

right, thanks
tbonfort commented 12 years ago

Author: jmckenna@dmsolutions.ca Date: 2004/11/30 - 03:32

verified.

however the functionality implemented in bug#944 for legendURL is this:

a warning is displayed only if both "wms_style" and
"wms_style_test_legendurl_href" are specified...i would think the desired
functionality would be that if a user is missing ANY of the required metadata
(width, height, format, href) for legendURL a warning should be displayed.  
tbonfort commented 12 years ago

Author: dmorissette Date: 2004/11/30 - 05:18

Producing a warning in all cases would just increase the complexity of code with
little benefit. As things are currently implemented, it's the legendurl_href
that triggers the whole legendurl stuff and that makes sense to me since that's
the most important piece of information and the least likely to be forgotten
(without an HREF, you can't even imagine having a LegendURL). 

What you're asking is that the presence of any of the metadatas could trigger a
cross-check of all other metadatas? You could always file an enhancement bug
about this if you think this would add value, but I believe that not
unnecessarily increasing code complexity should also be taken into account when
deciding what to do about this.
tbonfort commented 12 years ago

Author: jmckenna@dmsolutions.ca Date: 2004/11/30 - 05:30

ok agreed.  I just threw that out there for you and Tom just in case.