Skip to content

Commit 4c423d3

Browse files
rouaultgithub-actions[bot]
authored andcommitted
msLoadFontSet(): fix null pointer dereference
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52131
1 parent f60c84e commit 4c423d3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

maplabel.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,7 @@ int msLoadFontSet(fontSetObj *fontset, mapObj *map)
792792
char szPath[MS_MAXPATHLEN];
793793
int i;
794794
int bFullPath = 0;
795+
const char* realpath;
795796

796797
if(fontset->numfonts != 0) /* already initialized */
797798
return(0);
@@ -809,7 +810,12 @@ int msLoadFontSet(fontSetObj *fontset, mapObj *map)
809810
/* return(-1); */
810811
/* } */
811812

812-
stream = VSIFOpenL( msBuildPath(szPath, fontset->map->mappath, fontset->filename), "rb");
813+
realpath = msBuildPath(szPath, fontset->map->mappath, fontset->filename);
814+
if( !realpath ) {
815+
free(path);
816+
return -1;
817+
}
818+
stream = VSIFOpenL( realpath, "rb");
813819
if(!stream) {
814820
msSetError(MS_IOERR, "Error opening fontset %s.", "msLoadFontset()",
815821
fontset->filename);

0 commit comments

Comments
 (0)