If loadSymbol fails for some reason, it'll fclose msyyin and returns to
loadSymbolSet, which will try to fclose msyyin once again, which crashes libc
with double free check compiled in(which is default option for Fedora Core 4
for exampel)
But since loadSymbol is only called from loadSymbolSet and loadSymbolSet always
fcloses msyyin, why one should have to bother himself to close msyyin in
loadSymbol. I propose to comment all fclose(msyyin) in loadSymbol.
This can be done applying following patch:
--- mapserver-4.6.1/mapsymbol.orig.c 2005-09-08 10:16:32.000000000 +0400
+++ mapserver-4.6.1/mapsymbol.c 2005-09-08 10:23:03.000000000 +0400
@@ -249,7 +249,7 @@
case(IMAGE):
if(msyylex() != MS_STRING) { /* get image location from next token */
msSetError(MS_TYPEERR, "Parsing error near (%s):(line %d)",
"loadSymbol()", msyylineno);
- fclose(msyyin);
+ /* fclose(msyyin); */
return(-1);
}
@@ -257,7 +257,7 @@
{
msSetError(MS_IOERR, "Parsing error near (%s):(line %d)", "loadSymbol()",
msyytext, msyylineno);
- fclose(msyyin);
+ /* fclose(msyyin); */
return(-1);
}
@@ -296,7 +296,7 @@
if(s->img == NULL) {
msSetError(MS_GDERR, NULL, "loadSymbol()");
- fclose(msyyin);
+ /* fclose(msyyin); */
return(-1);
}
break;
@@ -331,7 +331,7 @@
default:
msSetError(MS_TYPEERR, "Parsing error near (%s):(line %d)",
"loadSymbol()",
msyytext, msyylineno);
- fclose(msyyin);
+ /* fclose(msyyin); */
return(-1);
}
@@ -361,7 +361,7 @@
default:
msSetError(MS_TYPEERR, "Parsing error near (%s):(line %d)",
"loadSymbol()",
msyytext, msyylineno);
- fclose(msyyin);
+ /* fclose(msyyin); */
return(-1);
}
if(done == MS_TRUE)
@@ -386,7 +386,7 @@
default:
msSetError(MS_IDENTERR, "Parsing error near (%s):(line %d)", "loadSymbol()",
msyytext, msyylineno);
- fclose(msyyin);
+ /* fclose(msyyin); */
return(-1);
} /* end switch */
} /* end for */
patch that fixes double close problem in loadSymbol/loadSymbolset