Fix possible buffer overflow in addMultirowsImg#277
Open
bptato wants to merge 1 commit intotats:masterfrom
Open
Fix possible buffer overflow in addMultirowsImg#277bptato wants to merge 1 commit intotats:masterfrom
bptato wants to merge 1 commit intotats:masterfrom
Conversation
Contributor
|
On Sat, Aug 05, 2023 at 01:14:03PM -0700, bptato wrote:
In 4e46481, a workaround was applied to prevent buffer overruns in
addMultirowsForm. Unfortunately, the same issue affects
addMultirowsImg; I have been able to consistently reproduce it by
enabling inline images and visiting https://html.spec.whatwg.org.
I have not yet figured out why exactly this can happen, but the
start/end indices are calculated in the same way at both locations
(i.e. at addMultirowsForm too), so it is unsurprising that the issue
persists. For now, I've just copy-pasted the same bounds checks;
further investigation might be needed on whether the COLPOS/columnPos
functions themselves are faulty or they were just used incorrectly.
I had a quick look. I can reproduce the issue, but also don't see why it
happens. I tried with the input from the issues linked in the commit,
to simplify the debugging but couldn't reproduce it with them (reverting
the fix obviously).
Maybe we should add a comment in the code explaining why we continue;
that it's a band-aid patch and that the problem is likely with
COLPOS/columnPos.
|
Contributor
Author
|
I've started to look into this a bit more. Some of my observations so far:
From this my conclusion is that COLPOS/columnPos are not the real culprit, |
9246212 to
46e2e46
Compare
A hack to avoid buffer overrun most likely caused by printing mis-positioned images on lines shorter than their intended line. May be related to 4e46481.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in 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.
In 4e46481, a workaround was applied to prevent buffer overruns in addMultirowsForm. Unfortunately, the same issue affects addMultirowsImg; I have been able to consistently reproduce it by enabling inline images and visiting https://html.spec.whatwg.org.
I have not yet figured out why exactly this can happen, but the start/end indices are calculated in the same way at both locations (i.e. at addMultirowsForm too), so it is unsurprising that the issue persists. For now, I've just copy-pasted the same bounds checks; further investigation might be needed on whether the COLPOS/columnPos functions themselves are faulty or they were just used incorrectly.