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

Rendering SVG with gradient Throw error "Uninitialized string offset 3" #102

Closed
MohAlRahabi opened this issue Jan 8, 2023 · 8 comments · Fixed by #105
Closed

Rendering SVG with gradient Throw error "Uninitialized string offset 3" #102

MohAlRahabi opened this issue Jan 8, 2023 · 8 comments · Fixed by #105
Labels
Milestone

Comments

@MohAlRahabi
Copy link

if ($value !== null && $value[3] !== 1 && array_key_exists("{$from}-opacity", $style_map) === true) {

@bsweeney
Copy link
Member

bsweeney commented Jan 9, 2023

Can you share a sample of the SVG causing the issue?

@MohAlRahabi
Copy link
Author

MohAlRahabi commented Jan 9, 2023

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="200" viewBox="0 0 200 200"><rect x="0" y="0" width="200" height="200" fill="#ffffff"/><g transform="scale(6.897)"><g transform="translate(0,0)"><defs><linearGradient gradientUnits="userSpaceOnUse" x1="0" y1="29" x2="29" y2="0" id="g1"><stop offset="0%" stop-color="#2e358f"/><stop offset="100%" stop-color="#2cab16"/></linearGradient></defs><path fill-rule="evenodd" d="M10 0L10 2L11 2L11 0ZM12 0L12 1L13 1L13 2L12 2L12 4L13 4L13 3L14 3L14 4L17 4L17 5L20 5L20 9L19 9L19 8L17 8L17 6L16 6L16 5L15 5L15 6L14 6L14 8L15 8L15 9L12 9L12 7L13 7L13 5L11 5L11 6L10 6L10 4L11 4L11 3L8 3L8 4L9 4L9 5L8 5L8 7L9 7L9 8L6 8L6 9L7 9L7 10L6 10L6 11L7 11L7 10L8 10L8 11L9 11L9 10L8 10L8 9L10 9L10 11L11 11L11 9L12 9L12 10L13 10L13 11L12 11L12 13L13 13L13 12L14 12L14 13L19 13L19 14L15 14L15 15L14 15L14 16L15 16L15 17L12 17L12 15L13 15L13 14L11 14L11 15L10 15L10 14L9 14L9 13L11 13L11 12L9 12L9 13L8 13L8 14L9 14L9 15L10 15L10 16L9 16L9 18L8 18L8 19L7 19L7 18L6 18L6 17L7 17L7 16L6 16L6 15L7 15L7 14L6 14L6 13L7 13L7 12L6 12L6 13L5 13L5 12L3 12L3 11L2 11L2 12L0 12L0 21L1 21L1 18L3 18L3 19L2 19L2 21L4 21L4 20L5 20L5 21L7 21L7 20L8 20L8 23L10 23L10 22L9 22L9 21L11 21L11 18L10 18L10 16L11 16L11 17L12 17L12 18L13 18L13 19L12 19L12 21L13 21L13 20L14 20L14 21L15 21L15 20L16 20L16 21L18 21L18 22L19 22L19 24L20 24L20 26L19 26L19 25L18 25L18 24L17 24L17 23L16 23L16 22L15 22L15 23L14 23L14 24L15 24L15 25L12 25L12 23L13 23L13 22L11 22L11 24L10 24L10 25L12 25L12 26L13 26L13 27L12 27L12 29L13 29L13 28L14 28L14 29L15 29L15 28L16 28L16 29L20 29L20 28L21 28L21 29L24 29L24 28L25 28L25 26L26 26L26 27L27 27L27 28L26 28L26 29L27 29L27 28L28 28L28 26L29 26L29 25L27 25L27 24L28 24L28 22L29 22L29 21L28 21L28 22L27 22L27 24L25 24L25 22L26 22L26 21L27 21L27 20L29 20L29 19L28 19L28 18L29 18L29 17L28 17L28 18L27 18L27 20L26 20L26 19L25 19L25 18L26 18L26 17L27 17L27 16L26 16L26 15L28 15L28 16L29 16L29 15L28 15L28 14L29 14L29 12L25 12L25 9L26 9L26 8L25 8L25 9L24 9L24 8L23 8L23 9L22 9L22 8L21 8L21 5L20 5L20 4L21 4L21 3L20 3L20 2L19 2L19 1L20 1L20 0L19 0L19 1L18 1L18 0L17 0L17 1L16 1L16 0L15 0L15 1L14 1L14 0ZM8 1L8 2L9 2L9 1ZM17 1L17 3L18 3L18 1ZM14 2L14 3L16 3L16 2ZM19 3L19 4L20 4L20 3ZM9 6L9 7L10 7L10 6ZM11 6L11 7L12 7L12 6ZM15 6L15 7L16 7L16 6ZM18 6L18 7L19 7L19 6ZM0 8L0 9L3 9L3 10L4 10L4 9L5 9L5 8ZM10 8L10 9L11 9L11 8ZM16 8L16 9L15 9L15 10L16 10L16 11L17 11L17 12L19 12L19 13L21 13L21 11L20 11L20 10L22 10L22 9L20 9L20 10L19 10L19 9L17 9L17 8ZM27 8L27 9L28 9L28 10L27 10L27 11L28 11L28 10L29 10L29 9L28 9L28 8ZM16 9L16 10L17 10L17 11L19 11L19 10L17 10L17 9ZM23 9L23 11L22 11L22 13L23 13L23 14L24 14L24 13L25 13L25 12L24 12L24 9ZM0 10L0 11L1 11L1 10ZM14 11L14 12L15 12L15 11ZM2 12L2 13L1 13L1 14L2 14L2 15L3 15L3 12ZM23 12L23 13L24 13L24 12ZM26 13L26 14L28 14L28 13ZM5 14L5 15L4 15L4 17L3 17L3 16L2 16L2 17L3 17L3 18L4 18L4 19L5 19L5 15L6 15L6 14ZM19 14L19 16L20 16L20 18L19 18L19 17L18 17L18 18L17 18L17 17L15 17L15 18L16 18L16 20L18 20L18 21L19 21L19 22L20 22L20 20L21 20L21 19L22 19L22 20L24 20L24 19L23 19L23 18L24 18L24 17L26 17L26 16L25 16L25 15L22 15L22 14L21 14L21 16L20 16L20 14ZM15 15L15 16L16 16L16 15ZM17 15L17 16L18 16L18 15ZM21 16L21 17L22 17L22 18L23 18L23 17L24 17L24 16L23 16L23 17L22 17L22 16ZM9 18L9 20L10 20L10 18ZM18 18L18 19L19 19L19 20L20 20L20 19L21 19L21 18L20 18L20 19L19 19L19 18ZM6 19L6 20L7 20L7 19ZM14 19L14 20L15 20L15 19ZM25 20L25 21L26 21L26 20ZM21 21L21 24L24 24L24 21ZM22 22L22 23L23 23L23 22ZM15 23L15 24L16 24L16 25L15 25L15 26L16 26L16 25L17 25L17 27L16 27L16 28L18 28L18 27L19 27L19 28L20 28L20 27L21 27L21 26L23 26L23 27L22 27L22 28L23 28L23 27L24 27L24 26L25 26L25 25L24 25L24 26L23 26L23 25L21 25L21 26L20 26L20 27L19 27L19 26L18 26L18 25L17 25L17 24L16 24L16 23ZM8 24L8 29L9 29L9 28L10 28L10 29L11 29L11 28L10 28L10 26L9 26L9 24ZM26 25L26 26L27 26L27 25ZM14 27L14 28L15 28L15 27ZM0 0L0 7L7 7L7 0ZM1 1L1 6L6 6L6 1ZM2 2L2 5L5 5L5 2ZM22 0L22 7L29 7L29 0ZM23 1L23 6L28 6L28 1ZM24 2L24 5L27 5L27 2ZM0 22L0 29L7 29L7 22ZM1 23L1 28L6 28L6 23ZM2 24L2 27L5 27L5 24Z" fill="url(#g1)"/></g></g></svg>

@bsweeney
Copy link
Member

bsweeney commented Jan 9, 2023

While there is some logic to handle gradients it looks like the feature was never completed. You can watch #16 for updates.

The specific issue here is that the current fill parsing logic does not gracefully handle the non-supported feature. I'll update that with the next release and look at gradient support for a follow-on release.

@bsweeney bsweeney closed this as completed Jan 9, 2023
@bsweeney bsweeney reopened this Jan 9, 2023
@bsweeney bsweeney added bug and removed duplicate labels Jan 9, 2023
@bsweeney bsweeney added this to the 0.5.1 milestone Jan 9, 2023
bsweeney added a commit that referenced this issue Feb 4, 2023
since feature is not yet complete.

fixes #102
@bsweeney bsweeney linked a pull request Feb 4, 2023 that will close this issue
bsweeney added a commit that referenced this issue Feb 5, 2023
since feature is not yet complete.

fixes #102
bsweeney added a commit that referenced this issue Feb 23, 2024
since feature is not yet complete.

fixes #102
@uphlewis
Copy link

uphlewis commented Feb 28, 2024

We're seeing the same error after updating to 0.5.2 to patch the the RCE vulnerability. Do you know which release you're targeting for this fix; will it be a patch release or will we need to wait a bit longer?

@bsweeney
Copy link
Member

This will be in the next release (0.5.3) which should be out sometime in the next week.

@uphlewis
Copy link

uphlewis commented Mar 6, 2024

This will be in the next release (0.5.3) which should be out sometime in the next week.

@bsweeney Thanks - are you able to estimate when this might be?

@bsweeney
Copy link
Member

bsweeney commented Mar 6, 2024

I had hoped to have it out by now, but some unrelated events have come up that have me distracted. As a result I doubt I'll have the release ready this week. Right now I would expect to see it early next week.

@bsweeney
Copy link
Member

FYI, the 0.5.3 release is published.

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.

3 participants