diff options
author | klapeto <yiannispana@hotmail.com> | 2023-12-29 18:33:09 +0200 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2025-01-25 14:22:50 +0100 |
commit | 70afa86d8c57d194e370c848540520e7bb034fca (patch) | |
tree | 3d6bb7f4b1df6479c46c5b4cb3b2f52657e6d863 /src | |
parent | dc3c3bc087ee5ae5a25e936eab62124685564d4b (diff) |
Fixed invalid memory read on single stop gradient
See: https://github.com/memononen/nanosvg/pull/252
Diffstat (limited to 'src')
-rw-r--r-- | src/nanosvgrast.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nanosvgrast.h b/src/nanosvgrast.h index 35175ee9..16b707fe 100644 --- a/src/nanosvgrast.h +++ b/src/nanosvgrast.h @@ -1301,8 +1301,9 @@ static void nsvg__initPaint(NSVGcachedPaint* cache, NSVGpaint* paint, float opac for (i = 0; i < 256; i++) cache->colors[i] = 0; } else if (grad->nstops == 1) { + unsigned int color = nsvg__applyOpacity(grad->stops[0].color, opacity); for (i = 0; i < 256; i++) - cache->colors[i] = nsvg__applyOpacity(grad->stops[i].color, opacity); + cache->colors[i] = color; } else { unsigned int ca, cb = 0; float ua, ub, du, u; |