tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 53c6a9618a3b0d68e0437e488b8253f760299603
parent 001ea90900b8602038774a1de3e697bd90166e4f
Author: Atila Butkovits <abutkovits@mozilla.com>
Date:   Thu,  9 Oct 2025 21:00:09 +0300

Revert "Bug 1978773 - Fix validatation of precise gradient addresses. r=lsalzman" for causing wrench failures complaining about atomic.h.

This reverts commit 939077064896a1fb6524aa72d563bdf4d5757aec.

Diffstat:
Mgfx/wr/glsl-to-cxx/src/hir.rs | 8--------
Mgfx/wr/swgl/src/swgl_ext.h | 14--------------
Mgfx/wr/webrender/res/ps_quad_gradient.glsl | 9+++++----
3 files changed, 5 insertions(+), 26 deletions(-)

diff --git a/gfx/wr/glsl-to-cxx/src/hir.rs b/gfx/wr/glsl-to-cxx/src/hir.rs @@ -3956,14 +3956,6 @@ pub fn ast_to_hir(state: &mut State, tu: &syntax::TranslationUnit) -> Translatio vec![Type::new(Sampler2D), Type::new(IVec2), Type::new(Int)], RunClass::Scalar, ); - declare_function_ext( - state, - "swgl_validateGradientFromStops", - None, - Type::new(Int), - vec![Type::new(Sampler2D), Type::new(IVec2), Type::new(Int)], - RunClass::Scalar, - ); declare_function( state, "swgl_commitLinearGradientRGBA8", diff --git a/gfx/wr/swgl/src/swgl_ext.h b/gfx/wr/swgl/src/swgl_ext.h @@ -1349,20 +1349,6 @@ static inline int swgl_validateGradient(sampler2D sampler, ivec2_scalar address, : -1; } -static inline int swgl_validateGradientFromStops(sampler2D sampler, ivec2_scalar address, - int entries) { - // 1px (4 floats per color stop). - int colors_size = entries; - // 4 stop offsets (4 floats) per px. - int stops_size = ((entries + 3) & ~3) / 4; - return sampler->format == TextureFormat::RGBA32F && address.y >= 0 && - address.y < int(sampler->height) && address.x >= 0 && - address.x < int(sampler->width) && entries > 0 && - address.x + colors_size + stops_size <= int(sampler->width) - ? address.y * sampler->stride + address.x * 4 - : -1; -} - static inline WideRGBA8 sampleGradient(sampler2D sampler, int address, Float entry) { assert(sampler->format == TextureFormat::RGBA32F); diff --git a/gfx/wr/webrender/res/ps_quad_gradient.glsl b/gfx/wr/webrender/res/ps_quad_gradient.glsl @@ -365,9 +365,11 @@ void swgl_drawSpanRGBA8() { int stop_count = v_gradient_header.y; int colors_address = v_gradient_header.w; - int colors_addr = swgl_validateGradientFromStops(sGpuBufferF, get_gpu_buffer_uv(colors_address), - stop_count); - if (colors_addr < 0) { + int colors_addr = swgl_validateGradient(sGpuBufferF, get_gpu_buffer_uv(colors_address), + stop_count); + int offsets_addr = swgl_validateGradient(sGpuBufferF, get_gpu_buffer_uv(colors_address + stop_count), + stop_count); + if (offsets_addr < 0 || colors_addr < 0) { // The gradient is invalid, this should not happen. We can't fall back to // the regular shader code because it expects the gradient stop offsets // to be laid out for a tree traversal but we laid them out linearly because @@ -377,7 +379,6 @@ void swgl_drawSpanRGBA8() { return; } - int offsets_addr = colors_addr + stop_count; vec2 pos = v_interpolated_data.xy; float start_radius = v_flat_data.x; bool repeat = v_gradient_header.z != 0.0;