Skip to content

Fix segfault in strtr using the Wu-Manber algorithm#6395

Closed
SiebelsTim wants to merge 1 commit intofacebook:masterfrom
SiebelsTim:strtr-crash
Closed

Fix segfault in strtr using the Wu-Manber algorithm#6395
SiebelsTim wants to merge 1 commit intofacebook:masterfrom
SiebelsTim:strtr-crash

Conversation

@SiebelsTim
Copy link
Contributor

We would not take the source string length into consideration when calculating
the smallest string. That would result in an unsigned integer overflow
calculating the lastpos in WuManberReplacement::translate. That would later
result in a segfault trying to access a char of a string beyond its size.

Fixes #6384

Test Plan: new test to confirm fixing the segfault. Old slow and zend tests
to confirm I didn't break anything.

We would not take the source string length into consideration when calculating
the smallest string. That would result in an unsigned integer overflow
calculating the lastpos in WuManberReplacement::translate. That would later
result in a segfault trying to access a char of a string beyond its size.

Fixes facebook#6384

Test Plan: new test to confirm fixing the segfault. Old slow and zend tests
to confirm I didn't break anything.
@facebook-github-bot
Copy link
Contributor

This pull request has been imported into Phabricator, and discussion and review of the diff will take place at https://reviews.facebook.net/D48969

@SiebelsTim
Copy link
Contributor Author

Closing in favor of #6071

@SiebelsTim SiebelsTim closed this Oct 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Segmentation fault (core) with 3.10.0 on strtr() on some chars if passed array exeeds 64 items

2 participants