Skip to content

Conversation

@jkeenan
Copy link

@jkeenan jkeenan commented May 19, 2025

In response to Tony's review in GH Perl#23301

In response to Tony's review in GH Perl#23301
@khwilliamson khwilliamson merged commit 3cc2038 into khwilliamson:UCD_num May 19, 2025
15 checks passed
@jkeenan jkeenan deleted the gh-23301-khwilliamson-UCD_num-20250519 branch July 4, 2025 18:10
khwilliamson pushed a commit that referenced this pull request Jul 7, 2025
This is #1 of a small series of commits to refactor the INPUT_handler()
method and turn it into a Node subclass method.

This commit changes the main loop from using $_ to hold the current line,
to using the variable $line instead.
khwilliamson pushed a commit that referenced this pull request Jul 7, 2025
This is #1 of a small series of commits to refactor the OUTPUT_handler()
method and turn it into a Node subclass method. This series is very
similar to the one earlier in this branch which did the same for
INPUT_handler().

This commit changes the main loop from using $_ to hold the current line,
to using the variable $line instead.
khwilliamson pushed a commit that referenced this pull request Sep 1, 2025
Fixes a Coverity issue:

    >>>     function_return: Function Perl_delimcpy_no_escape(tmpbuf, tmpbuf + 4096UL, s, bufend, 58, &len) modifies its argument, assigning 2147483647 to len.
    3553            s = delimcpy_no_escape(tmpbuf, tmpbuf + sizeof tmpbuf, s, bufend,
    3554                                   ':', &len);
    >>>     CID 583353: (#1 of 1): Overflowed constant (INTEGER_OVERFLOW)
    >>>     overflow_const: Expression len + 1, where len is known to be equal to 2147483647, overflows the type of len + 1, which is type int.
    3558            if (len + 1 + strlen(scriptname) + MAX_EXT_LEN >= sizeof tmpbuf)
    3559                continue;       /* don't search dir with too-long name */

If there is not enough available space in tmpbuf, delimcpy_no_escape
sets len to I32_MAX, but the following code does not check for this. (I
believe this case is reachable simply by setting PATH to a huge string.)

Avoid the potential overflow by rewriting

    A + B >= C

as

    A >= C - B

(Also, make 'len' unsigned (specifically, size_t) to match the type of
sizeof/strlen() and avoid warnings about comparisons between signed and
unsigned integers.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants