Skip to content

Commit ac702af

Browse files
committed
Fix segfault when file not found for p21read.
* When invalid file name passed to p21read, a segfault occured because p21read tried to continue parsing even though no file was found. An extra check for errors and early exit fixes this issue.
1 parent c316f21 commit ac702af

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/test/p21read/p21read.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ int main( int argc, char * argv[] ) {
152152
sfile.ReadExchangeFile( flnm );
153153
sfile.Error().PrintContents( cout );
154154

155+
if ( sfile.Error().severity() <= SEVERITY_INCOMPLETE )
156+
exit(1);
157+
155158
checkSchemaName( registry, sfile, ignoreErr );
156159

157160
Severity readSev = sfile.Error().severity(); //otherwise, errors from reading will be wiped out by sfile.WriteExchangeFile()

0 commit comments

Comments
 (0)