Page MenuHomePhabricator

Fix an issue with removing bytes in PhutilRope
ClosedPublic

Authored by epriestley on Dec 16 2015, 8:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Mar 26, 10:56 AM
Unknown Object (File)
Wed, Mar 13, 12:36 AM
Unknown Object (File)
Feb 23 2024, 11:39 PM
Unknown Object (File)
Feb 1 2024, 7:40 PM
Unknown Object (File)
Jan 28 2024, 3:27 AM
Unknown Object (File)
Jan 25 2024, 10:04 AM
Unknown Object (File)
Jan 21 2024, 12:37 PM
Unknown Object (File)
Jan 18 2024, 5:04 PM
Subscribers
None

Details

Summary

Via HackerOne, although this is not a security issue. PhutilRope does have a bug with byte handling, though.

Test Plan

Added a failing test and made it pass.

Diff Detail

Repository
rPHU libphutil
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Fix an issue with removing bytes in PhutilRope.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
chad edited edge metadata.
This revision is now accepted and ready to land.Dec 16 2015, 8:30 PM
src/utils/PhutilRope.php
102

The bug was here: we incorrectly used $length instead of $remaining_length, so we could strip too many bytes off the buffer. I've tried to rename variables to make the method more clear, since $len, $length and $remaining_length were fairly confusing.

src/utils/__tests__/PhutilRopeTestCase.php
33

Prior to this fix, this incorrectly output "ddddddddd".

This revision was automatically updated to reflect the committed changes.