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)
Oct 24 2024, 11:18 AM
Unknown Object (File)
Oct 18 2024, 11:14 PM
Unknown Object (File)
Oct 11 2024, 10:56 AM
Unknown Object (File)
Oct 11 2024, 10:56 AM
Unknown Object (File)
Oct 11 2024, 10:56 AM
Unknown Object (File)
Oct 11 2024, 10:36 AM
Unknown Object (File)
Sep 15 2024, 4:40 AM
Unknown Object (File)
Sep 15 2024, 4:38 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
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.