Debian Codegraph @

debian/patches/CVE-2026-17653

raw
1 From 6a4be3addd0a6e271e68a6a1bb873877e24813e9 Mon Sep 17 00:00:00 2001
2 From: Michael Ludwig <[email protected]>
3 Date: Fri, 12 Jun 2026 11:24:39 -0400
4 Subject: [PATCH] [graphite] Use stable collection for static bindings
5
6 Since the layouts are passed by pointer in the `nextInChain` field,
7 their addresses need to stay valid until the BindGroupLayout is created.
8 With vector, if it ever grew, that would not remain the case. Since
9 there are usually only 0 to 1 immutable samplers, this likely never
10 happened (and also why it uses a built-in storage for 1).
11
12 Also removes the include for vector and uses TArray (we had been mixing
13 both throughout the file).
14
15 Bug: https://issues.chromium.org/issues/520514458
16 Fixed: 520514458
17 Change-Id: I44c9566c68ab0e6c6d659ea77a423ddc50d53c76
18 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1264157
19 Reviewed-by: Thomas Smith <[email protected]>
20 Auto-Submit: Michael Ludwig <[email protected]>
21 Commit-Queue: Michael Ludwig <[email protected]>
22 ---
23 .../graphite/dawn/DawnGraphicsPipeline.cpp | 22 ++++++++++++-------
24 1 file changed, 14 insertions(+), 8 deletions(-)
25
26 --- a/src/gpu/graphite/dawn/DawnGraphicsPipeline.cpp
27 +++ b/src/gpu/graphite/dawn/DawnGraphicsPipeline.cpp
28 @@ -10,6 +10,8 @@
29 #include "include/gpu/graphite/TextureInfo.h"
30 #include "include/gpu/graphite/dawn/DawnGraphiteTypes.h"
31 #include "include/private/base/SkTemplates.h"
32 +#include "include/private/base/SkTArray.h"
33 +#include "src/base/SkTBlockList.h"
34 #include "src/core/SkTraceEvent.h"
35 #include "src/gpu/SkSLToBackend.h"
36 #include "src/gpu/Swizzle.h"
37 @@ -34,7 +36,8 @@
38 #include "src/sksl/ir/SkSLProgram.h"
39
40 #include <atomic>
41 -#include <vector>
42 +
43 +using namespace skia_private;
44
45 namespace skgpu::graphite {
46
47 @@ -152,7 +155,7 @@
48
49 size_t create_vertex_attributes(SkSpan<const Attribute> attrs,
50 int shaderLocationOffset,
51 - std::vector<wgpu::VertexAttribute>* out) {
52 + TArray<wgpu::VertexAttribute>* out) {
53 SkASSERT(out && out->empty());
54 out->resize(attrs.size());
55 size_t vertexAttributeOffset = 0;
56 @@ -499,12 +502,16 @@
57 !(samplerDescArrPtr && samplerDescArrPtr->at(0).isImmutable())) {
58 groupLayouts[1] = sharedContext->getSingleTextureSamplerBindGroupLayout();
59 } else {
60 - std::vector<wgpu::BindGroupLayoutEntry> entries(numTexturesAndSamplers);
61 + TArray<wgpu::BindGroupLayoutEntry> entries;
62 + entries.reset(numTexturesAndSamplers);
63 +
64 #if !defined(__EMSCRIPTEN__)
65 // Static sampler layouts are passed into Dawn by address and therefore must stay
66 // alive until the BindGroupLayoutDescriptor is created. So, store them outside of
67 - // the loop that iterates over each BindGroupLayoutEntry.
68 - skia_private::TArray<wgpu::StaticSamplerBindingLayout> staticSamplerLayouts;
69 + // the loop that iterates over each BindGroupLayoutEntry. Use a TBlockList so that
70 + // any append StaticSamplerBindingLayouts have a stable address in case we have to
71 + // grow the collection.
72 + SkTBlockList<wgpu::StaticSamplerBindingLayout, 1> staticSamplerLayouts;
73
74 // Note that the number of samplers is equivalent to numTexturesAndSamplers / 2. So,
75 // a sampler's index within any container that only pertains to sampler information
76 @@ -598,7 +605,7 @@
77 // Vertex state
78 std::array<wgpu::VertexBufferLayout, kNumVertexBuffers> vertexBufferLayouts;
79 // Static data buffer layout
80 - std::vector<wgpu::VertexAttribute> staticDataAttributes;
81 + TArray<wgpu::VertexAttribute> staticDataAttributes;
82 {
83 auto arrayStride = create_vertex_attributes(step->staticAttributes(),
84 0,
85 @@ -622,7 +629,7 @@
86 }
87
88 // Append data buffer layout
89 - std::vector<wgpu::VertexAttribute> appendDataAttributes;
90 + TArray<wgpu::VertexAttribute> appendDataAttributes;
91 {
92 // Note: the shaderLocationOffset in this function call needs to be the staticAttributeSize
93 auto arrayStride = create_vertex_attributes(step->appendAttributes(),