#20411 fix Yaml parsing for very long quoted strings #21279

Merged
merged 1 commit into from Jan 14, 2017

Projects

None yet

4 participants

@RichardBradley
Contributor
Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #20411
License MIT
Doc PR no

This fixes #20411, a YAML string with too many backslash escapes can trigger a PREG_BACKTRACK_LIMIT_ERROR error in the Yaml parser.

There should be no behavioural change other than the bug fix

I have included a test which fails before this fix and passes after this fix.

+ {
+ $longStringWithQuotes = str_repeat("x\r\n\\\"x\"x", 1000);
+
+ $yamlString = Inline::dump(['longStringWithQuotes' => $longStringWithQuotes]);
@stof
stof Jan 13, 2017 Member

the short array syntax does not work on PHP 5.3, which is still supported by Symfony 2.7. Please change it.

@RichardBradley
RichardBradley Jan 13, 2017 Contributor

Sorry, good point.
I've pushed a new version.

@stof
Member
stof commented Jan 13, 2017

👍 (once the PHP 5.3 compat is fixed of course)

@RichardBradley RichardBradley #20411 fix Yaml parsing for very long quoted strings
51bca66
@stof
stof approved these changes Jan 13, 2017 View changes
@xabbuh
Member
xabbuh commented Jan 14, 2017

Thank you @RichardBradley.

@xabbuh xabbuh merged commit 51bca66 into symfony:2.7 Jan 14, 2017

2 of 3 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
fabbot.io Your code looks good.
Details
@xabbuh xabbuh added a commit that referenced this pull request Jan 14, 2017
@xabbuh xabbuh bug #21279 #20411 fix Yaml parsing for very long quoted strings (Rich…
…ardBradley)

This PR was merged into the 2.7 branch.

Discussion
----------

#20411 fix Yaml parsing for very long quoted strings

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #20411
| License       | MIT
| Doc PR        | no

This fixes #20411, a YAML string with too many backslash escapes can trigger a `PREG_BACKTRACK_LIMIT_ERROR` error in the Yaml parser.

There should be no behavioural change other than the bug fix

I have included a test which fails before this fix and passes after this fix.

Commits
-------

51bca66 #20411 fix Yaml parsing for very long quoted strings
c18c93b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment