Skip to content

Commit dcedd9c

Browse files
committed
Spurious characters in Fortran Fixed to free format conversion
After review: protection against out of bounds.
1 parent d1fc343 commit dcedd9c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/fortranscanner.l

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1827,7 +1827,13 @@ const char* prepassFixedForm(const char* contents, int *hasContLine,int fixedCom
18271827
return NULL;
18281828
}
18291829

1830-
if (newContents[j] == '\n')
1830+
if (sizCont==0)
1831+
{
1832+
newContents = (char*)realloc(newContents, 2);
1833+
newContents[0] = '\n';
1834+
newContents[1] = '\000';
1835+
}
1836+
else if (newContents[j] == '\n')
18311837
{
18321838
newContents = (char*)realloc(newContents, j+2);
18331839
newContents[j + 1] = '\000';

0 commit comments

Comments
 (0)