[Rpm-maint] [rpm-software-management/rpm] Fix Fseek for offset > 2GiB (#1381)

malmond77 notifications at github.com
Fri Oct 2 22:00:02 UTC 2020


rpmio wraps a number of different file types, regular files and ones with compression. The only file type that supports seeking is regular files. This uses `LSEEK(2)` under the hood. I believe this is defined to return `off_t` which is signed. The function returns the offset (which is non negative in the normal case), or `-1` on error.

There's two specific issues here, so two patches:

1. `off_t` is being truncated to `int` (usually 32bit) on 64 bit arch. As there's only one implementation we can change the signature. Also the Ftell returns `off_t` already so this simply brings it in line.
2. The error checks are using `< 0` which is strictly correct - it's impossible to return a normal offset that's negative. Still, the function is documented as returning `-1`  so in the interest of correctness, I think it's worth fixing that too.
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/1381

-- Commit Summary --

  * Make Fseek return off_t not int
  * Use == -1 instead of < 0 for Fseek failure checking

-- File Changes --

    M build/pack.c (2)
    M python/rpmfd-py.c (2)
    M rpmio/rpmio.c (8)
    M rpmio/rpmio.h (2)
    M sign/rpmgensig.c (6)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/1381.patch
https://github.com/rpm-software-management/rpm/pull/1381.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1381
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20201002/76899dde/attachment.html>


More information about the Rpm-maint mailing list