Needed patch to avoid Access Violations for paths without previous points#191
Open
NicklasBergfeldt wants to merge 7 commits intoAngusJohnson:mainfrom
Open
Needed patch to avoid Access Violations for paths without previous points#191NicklasBergfeldt wants to merge 7 commits intoAngusJohnson:mainfrom
NicklasBergfeldt wants to merge 7 commits intoAngusJohnson:mainfrom
Conversation
…nt TSvgReader instance (under concurrent rendering) or elements of the wrong type (hash collision on short single-letter IDs like a, b, c in the SVG). The original code hard-casts these results without type checks and accesses renderers through with statements that resolve fSvgReader ambiguously. Fix 1 - const drawDat on PrepareRenderer (lines 463, 473, 483, implementations): prevents by-value copy of the large TDrawData record, eliminating stack corruption during parameter passing. Fix 2 - Renderer re-read in PrepareRenderer (TLinGradElement, TRadGradElement): both implementations now ignore the renderer parameter and re-read from fSvgReader.LinGradRenderer / fSvgReader.RadGradRenderer at method entry. Eliminates parameter corruption traced through debugging where the renderer pointer changed between call site and function entry. Fix 3 - DrawFilled/DrawStroke use refEl.fSvgReader: gradient rendering accesses renderers through the gradient element's own reader (refEl.fSvgReader) instead of the shape's reader (Self.fSvgReader). Removes with TLinGradElement(refEl) do pattern that resolved fSvgReader ambiguously. Fix 4 - AV guard in TGradientElement.PrepareRenderer: wraps el is TGradientElement in try/except to catch corrupt element pointers from FindRefElement, converting AV to a descriptive exception with the bad refEl string and gradient ID. Fix 5 - Type-safe FindRefElement casts: added is type checks before all hard casts of FindRefElement results in TGroupElement.Draw (TMaskElement, TClipPathElement, TFilterElement) and TShapeElement.Draw (same three). Previously, FindRefElement returning a wrong-type element (e.g., linearGradient "b" when looking up a clipPath) caused hard-cast to garbage fields -> AV in CopyPaths or TFilterElement.Clear.
Owner
|
Hi Nicklas.
It would really help if you could provide minimal test SVG images that generate the errors you are trying to fix. |
Author
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.
No description provided.