Opened 15 years ago

Last modified 15 years ago

#2922 new defect

Mapfile parser doesn't error if there's remaining data after the closing END tag

Reported by: tbonfort Owned by: sdlime
Priority: normal Milestone: 6.0 release
Component: MapServer C Library Version: unspecified
Severity: normal Keywords:
Cc:

Description

MAP
 ...
 LAYER
  ...
 END
END
LAYER
 ...
END

has a closing END tag placed too early, but the mapfile parser does not error. This can be confusing as the second layer doesn't show up in the rendered map

Change History (1)

comment:1 by tbonfort, 15 years ago

patch to throw an error

Index: mapfile.c
===================================================================
--- mapfile.c	(revision 8648)
+++ mapfile.c	(working copy)
@@ -4739,6 +4739,11 @@
       if(map->debug == MS_NUMBER) map->debug = (int) msyynumber;
       break;
     case(END):
+      if(msyylex()!=EOF) {
+    	  msSetError(MS_IDENTERR, "Stray keyword (%s) (line %d) after closing END", "msLoadMap()", 
+    	                   msyytext, msyylineno);
+    	  return MS_FAILURE;
+      }
       if(msyyin) {
           fclose(msyyin);
           msyyin = NULL;
Note: See TracTickets for help on using tickets.