Crash for currentColor
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- swift
- Domain
- computer-graphics
Research direction
Start with SVGColor.parseColor(::) and reproduce the crash using the SVG in the issue, especially its root style and currentColor attributes. Trace how the color lookup handles currentColor when it resolves to another currentColor. Done means the supplied SVG parses without recursion or a crash and its color is resolved consistently.
Written by the indexing model from the issue text.
Description
this is the test svg:
<svg width="16" height="24" viewBox="0 0 16 24" style="color: red;" xmlns="http://www.w3.org/2000/svg">
<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" color="currentColor"><path d="M5.533 17c-1.422 2.006-1.78 3.065-1.38 3.916q.06.126.14.243C4.862 22 6.34 22 9.295 22h5.408c2.955 0 4.432 0 5.004-.841q.08-.118.139-.243c.4-.85.042-1.91-1.38-3.916"/><path d="M12.998 7h-1.996c-2.87 0-4.805 3.07-3.674 5.828a1 1 0 0 0 .918.633h.703c.237 0 .444.17.501.41l.905 3.786c.189.79.867 1.343 1.645 1.343s1.456-.554 1.645-1.343l.905-3.786a.52.52 0 0 1 .5-.41h.704a1 1 0 0 0 .918-.633C17.804 10.069 15.869 7 12.999 7"/><path d="M14.5 4.5a2.5 2.5 0 1 1-5 0a2.5 2.5 0 0 1 5 0"/></g>
</svg>
it seems not parse style in svg tag, and will recursive at this function:
static func parseColor(_ string: String, _ style: [String: String]) -> SVGColor? {
let normalized = string.replacingOccurrences(of: " ", with: "")
if normalized == "none" || normalized == "transparent" {
return .none
} else if normalized == "currentColor", let currentColor = style["color"] {
return parseColor(currentColor, style)
} else if let defaultColor = SVGColor.by(name: normalized) {
return defaultColor
} else if normalized.hasPrefix("rgb") {
return parseRGBNotation(colorString: normalized)
} else {
return createColorFromHex(normalized)
}
}
- Dominant language
- Swift
- Stars
- 853
- Forks
- 112
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from exyte/SVGView
-
Make view resizable Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
-
Support % sizes Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
type: docs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
googleapis/google-cloud-swift#971 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mozilla-mobile/firefox-ios#35743 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
manaflow-ai/cmux#13417 ·