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
F13053267: D14801.diff
Fri, Apr 19, 11:06 AM
Unknown Object (File)
Mon, Apr 8, 8:16 PM
Unknown Object (File)
Mon, Apr 8, 6:18 PM
Unknown Object (File)
Tue, Mar 26, 10:56 AM
Unknown Object (File)
Mar 13 2024, 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
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
Branch
rope1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 9604
Build 11491: Run Core Tests
Build 11490: arc lint + arc unit

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.