Sign extension at phar_object.c
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
The field compressed_filesize is a uint32_t, but PharFileInfo::getCompressedSize() returns it with RETURN_LONG:
https://github.com/php/php-src/blob/fca72841a5d41b11c0e60ed0906af6af302741ca/ext/phar/phar_object.c#L4497
zend_long is 32-bit on 32-bit platforms:
https://github.com/php/php-src/blob/fca72841a5d41b11c0e60ed0906af6af302741ca/Zend/zend_long.h#L41-L49
so a size above INT32_MAX is reported as a negative number.
Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
Reporter: Pavel Nekrasov (p.nekrasov@fobos-nt.ru).
PHP Version
php version - 8.3
Operating System
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in ext/phar/phar_object.c at PharFileInfo::getCompressedSize(), then read the zend_long definition in Zend/zend_long.h. Reproduce the large compressed_filesize case on a 32-bit build and add or update the relevant Phar regression coverage. Done means values above INT32_MAX are no longer reported as negative.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100