https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115057

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Gaius Mulley <ga...@gcc.gnu.org>:

https://gcc.gnu.org/g:680af0e1e90d4b80260d173636dfe15654fd470d

commit r15-516-g680af0e1e90d4b80260d173636dfe15654fd470d
Author: Gaius Mulley <gaiusm...@gmail.com>
Date:   Wed May 15 16:58:21 2024 +0100

    PR modula2/115057 TextIO.ReadRestLine raises an exception when buffer is
exceeded

    TextIO.ReadRestLine will raise an "attempting to read beyond end of file"
    exception if the buffer is exceeded.  This bug is caused by the
    TextIO.ReadRestLine calling IOChan.Skip without a preceeding IOChan.Look.
    The Look procedure will update the status result whereas
    Skip always sets read result to allRight.

    gcc/m2/ChangeLog:

            PR modula2/115057
            * gm2-libs-iso/TextIO.mod (ReadRestLine): Use ReadChar to
            skip unwanted characters as this calls IOChan.Look and updates
            the cid result status.  A Skip without a Look does not update
            the status.  Skip always sets read result to allRight.
            * gm2-libs-iso/TextUtil.def (SkipSpaces): Improve comments.
            (CharAvailable): Improve comments.
            * gm2-libs-iso/TextUtil.mod (SkipSpaces): Improve comments.
            (CharAvailable): Improve comments.

    gcc/testsuite/ChangeLog:

            PR modula2/115057
            * gm2/isolib/run/pass/testrestline.mod: New test.
            * gm2/isolib/run/pass/testrestline2.mod: New test.
            * gm2/isolib/run/pass/testrestline3.mod: New test.

    Signed-off-by: Gaius Mulley <gaiusm...@gmail.com>

Reply via email to