Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mapserver-bot opened this issue Apr 3, 2012 · 3 comments

Comments

@mapserver-bot
Copy link

Reporter: tbonfort
Date: 2009/03/08 - 15:11
Trac URL: http://trac.osgeo.org/mapserver/ticket/2922

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

@mapserver-bot
Copy link
Author

Author: tbonfort
Date: 2009/03/08 - 15:12
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;

@ghost ghost assigned sdlime Apr 5, 2012
@ghost ghost assigned tbonfort May 24, 2012
@jratike80
Copy link

Unintentionally truncated mapfiles appear quite often for me when cutting/copying/pasting parts of mapfiles. Hard to imagine any bad side effects due to this fix, so why not to make it live?

@jratike80
Copy link

Any opinions? Close as won't fix and keep on waiting that someone takes care of merging the code and making a test?

@jratike80 jratike80 added Enhancement and removed Bug labels Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants