Opened 19 years ago

Closed 19 years ago

Last modified 19 years ago

#1096 closed defect (fixed)

[WMS Server] Crash when using wms_style* metadata

Reported by: jmckenna@… Owned by: mapserverbugs
Priority: high Milestone:
Component: WMS Server Version: 4.4
Severity: normal Keywords: VERIFIED
Cc:

Description

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
  ...

Change History (11)

comment:1 by jmckenna@…, 19 years ago

Cc: tom.kralidis@… added

comment:2 by jmckenna@…, 19 years ago

blocked: 992

comment:3 by jmckenna@…, 19 years ago

mapserv crashes on a GetCapabilities request

comment:4 by dmorissette, 19 years ago

Status: newassigned
This happens because of poor management of the pszMetadataName in msDumpLayer()
when writing the legendURl coming from metadata. Cleaning this up now.

comment:5 by dmorissette, 19 years ago

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

comment:6 by dmorissette, 19 years ago

Milestone: 4.4 release
Resolution: fixed
Status: assignedclosed
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.

comment:7 by dmorissette, 19 years ago

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"  

comment:8 by jmckenna@…, 19 years ago

right, thanks

comment:9 by jmckenna@…, 19 years ago

Keywords: VERIFIED added
Milestone: 4.4 release
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.  

comment:10 by dmorissette, 19 years ago

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.

comment:11 by jmckenna@…, 19 years ago

ok agreed.  I just threw that out there for you and Tom just in case.
Note: See TracTickets for help on using tickets.