-
-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Description
Hi,
while building an fpm PR that uses Jonquil, the Windows build fails at the first JSON serialization test with the following message:
# Starting serialize-git-target ... (4/24)
At line 184 of file build\dependencies\jonquil\src\jonquil\lexer.f90
Fortran runtime error: Substring out of bounds: upper bound (132) of 'lexer' exceeds string length (131)
Error termination. Backtrace:
Could not print backtrace: libbacktrace could not find executable to open
I am not sure if the problem is upstream, but in the same routine, an out-of-bounds error is possible:
! If lexer is exhausted, return EOF as early as possible
if (pos > len(lexer%chunk)) then
token = toml_token(token_kind%eof, prev, pos)
return
end if
! [fp] at this point, it is possible that pos == len(lexer%chunk), which would cause the out of bounds
select case(lexer%chunk(pos:pos))
case(" ", toml_escape%tabulator, toml_escape%newline, toml_escape%carriage_return)
do while(any(lexer%chunk(pos+1:pos+1) == [" ", toml_escape%tabulator, &
& toml_escape%newline, toml_escape%carriage_return]) .and. pos < len(lexer%chunk)) ! [fp] here
pos = pos + 1
end do
token = toml_token(token_kind%whitespace, prev, pos)
return
Possible (untested) solution:
if (pos<len(lexer%chunk)) then
do while(any(lexer%chunk(pos+1:pos+1) == [" ", toml_escape%tabulator, &
& toml_escape%newline, toml_escape%carriage_return]) .and. pos < len(lexer%chunk)) ! [fp] here
pos = pos + 1
end do
endif
Metadata
Metadata
Assignees
Labels
No labels