dev-libs/jonquil: 0.2.0 revbump; fix serializer, fix array bounds

Add upstream patches to fix opening brace in serializer
and to fix exceed array bounds.

Signed-off-by: Sergey Torokhov <torokhov-s-a@yandex.ru>
This commit is contained in:
Sergey Torokhov
2025-04-13 19:21:13 +03:00
parent 33b2f7673a
commit eb9e9425b4
3 changed files with 82 additions and 1 deletions

View File

@@ -0,0 +1,54 @@
From 4fbd4cf34d577c0fd25e32667ee9e41bf231ece8 Mon Sep 17 00:00:00 2001
From: urbanjost <urbanjost@comcast.net>
Date: Wed, 21 Jun 2023 04:08:07 -0400
Subject: [PATCH] Prevent exceeding array bounds (#17)
---
src/jonquil/lexer.f90 | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/jonquil/lexer.f90 b/src/jonquil/lexer.f90
index e52123a..aa6e4a0 100644
--- a/src/jonquil/lexer.f90
+++ b/src/jonquil/lexer.f90
@@ -181,10 +181,12 @@ subroutine next_token(lexer, token)
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))
- pos = pos + 1
+ do pos = pos, len(lexer%chunk) - 1
+ if (all(lexer%chunk(pos+1:pos+1) /= [" ", toml_escape%tabulator,&
+ & toml_escape%newline, toml_escape%carriage_return])) &
+ & exit
end do
+
token = toml_token(token_kind%whitespace, prev, pos)
return
case(":")
@@ -216,10 +218,10 @@ subroutine next_token(lexer, token)
return
end select
- ! If the current token is invalid, advance to the next terminator
- do while(verify(lexer%chunk(pos+1:pos+1), terminated) > 0 .and. pos < len(lexer%chunk))
- pos = pos + 1
+ do pos=pos,len(lexer%chunk)-1
+ if (verify(lexer%chunk(pos+1:pos+1), terminated) <= 0) exit
end do
+
token = toml_token(token_kind%invalid, prev, pos)
end subroutine next_token
@@ -338,8 +340,8 @@ subroutine next_boolean(lexer, token)
prev = lexer%pos
pos = lexer%pos
- do while(verify(lexer%chunk(pos+1:pos+1), terminated) > 0 .and. pos < len(lexer%chunk))
- pos = pos + 1
+ do pos=lexer%pos,len(lexer%chunk)-1
+ if (verify(lexer%chunk(pos+1:pos+1), terminated) <= 0) exit
end do
select case(lexer%chunk(prev:pos))

View File

@@ -0,0 +1,22 @@
From eedf6947abcafe2967714922ecbf403426454e1d Mon Sep 17 00:00:00 2001
From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com>
Date: Tue, 11 Apr 2023 21:36:39 +0200
Subject: [PATCH] Correctly emit opening brace in serializer (#14)
---
src/jonquil/ser.f90 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/jonquil/ser.f90 b/src/jonquil/ser.f90
index d2a19d5..c9dad41 100644
--- a/src/jonquil/ser.f90
+++ b/src/jonquil/ser.f90
@@ -344,7 +344,7 @@ subroutine visit_table(visitor, table)
visitor%output = visitor%output // """" // key // """: "
end if
- visitor%output = visitor%output // ","
+ visitor%output = visitor%output // "{"
visitor%depth = visitor%depth + 1
call table%get_keys(list)

View File

@@ -1,4 +1,4 @@
# Copyright 1999-2023 Gentoo Authors
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -27,6 +27,11 @@ DEPEND="
test? ( dev-util/fortran-test-drive )
"
PATCHES="
${FILESDIR}/${P}_fix_opening_brace_in_serializer.patch
${FILESDIR}/${P}_fix_exceed_array_bounds.patch
"
src_configure() {
local mycmakeargs=(
-DENABLE_TESTING=$(usex test)