php / php/php-src

Sign extension at phar_object.c

Open Beginner friendly
#23,718 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Status: Needs Triage
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.