Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIMD instruction can cause seg-fault/UMR #85

Closed
miloyip opened this issue Jul 28, 2014 · 0 comments · Fixed by #87
Closed

SIMD instruction can cause seg-fault/UMR #85

miloyip opened this issue Jul 28, 2014 · 0 comments · Fixed by #87
Assignees
Labels
Milestone

Comments

@miloyip
Copy link
Collaborator

miloyip commented Jul 28, 2014

https://code.google.com/p/rapidjson/issues/detail?id=104

According to Agner's SSE A_strlen() implementation (http://www.agner.org/optimize/asmlib.zip),

; Misaligned parts of the string are read from the nearest 16-bytes boundary
; and the irrelevant part masked out. It may read both before the begin of 
; the string and after the end, but will never load any unnecessary cache 
; line and never trigger a page fault for reading from non-existing memory 
; pages because it never reads past the nearest following 16-bytes boundary.
; It may, though, trigger any debug watch within the same 16-bytes boundary.

So it should be possible to modify RapidJSON's SkipWhitespace_SIMD() to make it work safely. Currently it read 16 bytes unaligned from start of string, which will be possible to read bytes past the end of page boundary and cause segmentation fault.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant