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

Fixed a index out of bound error when trying to delete the first line… #1003

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

yixiang
Copy link
Contributor

@yixiang yixiang commented Oct 5, 2016

Fix a index out of bound error when deleting the first line of a document. (Issue #1004, which was introduced by #676) The error comes from a case where pos is 0 and we are trying to access character at pos - 1, which is -1 but then overflows to MAX_UINT64 / MAX_UINT32 because pos is of type NSUInteger.

Notes to reviewers:

This is just a temporary fix to silent the error. However, the nature of the issue extend beyond the index out of bound error. The code is comparing pos against index, which makes no sense to me. pos is a position in terms of characters but index is line the line number. It definitely feels wrong to compare them, but I was not able to figure out what the expected behavior is with my time constraints. So I'm going to leave that to those who are more familiar with the code. Filed #1005.

@JugglerShu
Copy link
Contributor

This should be fixed in the latest develop branch. If everything works fine, please close this.

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

Successfully merging this pull request may close these issues.

2 participants