bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: maint: prefer ckd_add to INT_ADD_WRAPV


From: Collin Funk
Subject: Re: maint: prefer ckd_add to INT_ADD_WRAPV
Date: Sun, 04 Aug 2024 02:10:00 -0700
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Paul,

Paul Eggert <eggert@cs.ucla.edu> writes:

> Thanks, this prompted me to scan tar for integer overflow and related
> bugs. Now's a good time to install what I found so far, so I did that.
> One of the patches is the following; it is related to your suggestion,
> but is a bit more general because it also replaces some other uses of
> intprops.h macros.

Yeah, I wanted to remove the INT_*_OVERFLOW macros too but was a bit
wary of breaking things. That patch looks good, thanks.

I didn't check the others much but found this one funny [1].  I always
preferred this too:

    offset = lseek (fd, 0, SEEK_DATA)
    if (offset < 0)

over:

    offset = lseek (fd, 0, SEEK_DATA)
    if (offset == -1)

Collin

[1] 
https://git.savannah.gnu.org/cgit/tar.git/commit/?id=281e03ec6ccb9e6da134f8f6b9a9ff51c42f5737



reply via email to

[Prev in Thread] Current Thread [Next in Thread]