-
Notifications
You must be signed in to change notification settings - Fork 468
Fixes for: heap-use-after-free in parser error handling; out-of-range in special_number
#2755
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Looks there are regressions on the windows builds.
…On Thu., 22 Nov. 2018, 11:11 pm Gleb Mazovetskiy ***@***.*** wrote:
Fixes #2643 <#2643>: pstate.src may
not outlive stack unwind so we must copy it.
Also optimizes line_begin/end search in handle_error. There is no need to
advance by UTF-8 code points when searching for an ASCII character, because
UTF-8 is a prefix-free encoding.
------------------------------
You can view, comment on, or merge this pull request online at:
#2755
Commit Summary
- Fix heap-use-after-free in Parser error handling
- Optimize line_begin/end search in `handle_error`
File Changes
- *M* src/error_handling.cpp
<https://github.com/sass/libsass/pull/2755/files#diff-0> (4)
- *M* src/error_handling.hpp
<https://github.com/sass/libsass/pull/2755/files#diff-1> (5)
- *M* src/parser.cpp
<https://github.com/sass/libsass/pull/2755/files#diff-2> (5)
- *M* src/sass_context.cpp
<https://github.com/sass/libsass/pull/2755/files#diff-3> (17)
Patch Links:
- https://github.com/sass/libsass/pull/2755.patch
- https://github.com/sass/libsass/pull/2755.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2755>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAjZWEJqcJgItl36EX0XrYNe_Otig3tgks5uxpRVgaJpZM4YvOtF>
.
|
There is no need to advance by UTF-8 code points when searching for an ASCII character, because UTF-8 is a prefix-free encoding.
special_number
Out-of-range string access happened when `s->value()` was shorter than "var(" or "calc(".
Ah, nevermind, Windows still failing. The whack-a-mole continues. |
Not reproducible on Visual Studio 2015 and Visual Studio 2017, so I'm downloading Visual Studio 2012 now. |
Oh, Microsoft Visual Studio 12.0 is actually Visual Studio 2013. 😐 |
Finally fixed. Learned that exceptions must have a copy constructor (https://stackoverflow.com/a/10855545). In my day job we don't use exceptions. |
The copy constructor transfers the ownership of `owned_src` from `rhs` to `lhs`. Otherwise, `owned_src` may be destroyed too early and more than once. In the libsass codebase, this copy can only happen on `throw`. Modern compilers elide such copies. In our CI, only VS 2013 does not.
Whoa awesome work! |
xzyfer
approved these changes
Nov 23, 2018
This was referenced Nov 23, 2018
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2643:
pstate.src
may not outlive stack unwind so we must copy it.Also optimizes line_begin/end search in
handle_error
. There is no need to advance by UTF-8 code points when searching for an ASCII character, because UTF-8 is a prefix-free encoding.