]> git.ipfire.org Git - thirdparty/gcc.git/commit
[PR modula2/120731] error in Strings.Pos causing sigsegv
authorGaius Mulley <gaiusmod2@gmail.com>
Sun, 22 Jun 2025 03:13:26 +0000 (04:13 +0100)
committerGaius Mulley <gaiusmod2@gmail.com>
Sun, 22 Jun 2025 03:13:26 +0000 (04:13 +0100)
commitfc276742e0db337c4d13e6c474abafd4796a6b69
treeaf70bac82fa1d3d92ecd3ebb660b7a4fc6df0b27
parent6e38bef16bbfaa7743d1ec8937ed9dfba669136d
[PR modula2/120731] error in Strings.Pos causing sigsegv

This patch corrects the m2log library procedure function
Strings.Pos which incorrectly sliced the wrong component
of the source string.  The incorrect slice could cause
a sigsegv if negative slice indices were generated.

gcc/m2/ChangeLog:

PR modula2/120731
* gm2-libs-log/Strings.def (Delete): Rewrite comment.
* gm2-libs-log/Strings.mod (Pos): Rewrite.
(PosLower): New procedure function.

gcc/testsuite/ChangeLog:

PR modula2/120731
* gm2/pimlib/logitech/run/pass/teststrings.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
gcc/m2/gm2-libs-log/Strings.def
gcc/m2/gm2-libs-log/Strings.mod
gcc/testsuite/gm2/pimlib/logitech/run/pass/teststrings.mod [new file with mode: 0644]