cbuffer with a double2x2/double2x3 matrix generates a cbufferLoadLegacy past the end of the cbuffer ("Cbuffer access out of bound")
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
Start by compiling the provided HLSL repro with dxc -T cs_6_2 -E main repro.hlsl and inspect the generated DXIL and cbuffer layout around the reported cbufferLoadLegacy row. The attached repro_double_matrix_cbuffer_dxil.cpp covers the failing and passing cases. Done means the double2x2 and double2x3 cases validate without out-of-bounds loads while the listed passing cases remain valid.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
A cbuffer containing a matrix with two rows of doubles (double2x2, double2x3) compiles to DXIL that DXC's own validator rejects with "Cbuffer access out of bound". The module loads a 16-byte row past the cbuffer it declares: the cbuffer is declared N bytes, and the module reads row N/16 or beyond.
These cases compile and validate fine:
double3x3- a
double2array float2x2- the same
double2x2followed by another member, but only because that member grows the cbuffer past the row being read, which hides the bug.
Steps to Reproduce
dxc -T cs_6_2 -E main repro.hlsl
cbuffer CB { double a; double2x2 m; }
RWByteAddressBuffer o;
[numthreads(1, 1, 1)]
void main(uint id : SV_DispatchThreadID) { o.Store<float>(0, (float) (a + m[1][1])); }
A standalone repro covering all the cases below is attached (repro_double_matrix_cbuffer_dxil.cpp).
Actual Behavior
error: validation errors
repro.hlsl:4:75: error: Cbuffer access out of bound.
note: at '%5 = call %dx.types.CBufRet.f64 @dx.op.cbufferLoadLegacy.f64(i32 59, %dx.types.Handle %2, i32 3)' in block '#0' of function 'main'.
With -Vd, the cbuffer is declared 48 bytes (rows 0..2, m at offset 16), but m[1][1] is loaded from row 3:
; double a; ; Offset: 0
; column_major double2x2 m; ; Offset: 16
; } CB; ; Offset: 0 Size: 48
All cases:
cbuffer CB { double2x2 m; } error: Cbuffer access out of bound. (declares 32 bytes, loads row 2)
cbuffer CB { double a; double2x2 m; } error: Cbuffer access out of bound. (declares 48 bytes, loads row 3)
cbuffer CB { double a; double2x3 m; } error: Cbuffer access out of bound. (declares 64 bytes, loads row 5)
cbuffer CB { double2x2 m; double a; } ok
cbuffer CB { double a; double3x3 m; } ok
cbuffer CB { double a; double2 m[2]; } ok
cbuffer CB { float a; float2x2 m; } ok
Environment
- DXC version: <latest release, from
dxc --version>; also reproduces on main, libdxcompiler.so: 1.11(5563-75fba619)(1.10.0.15563) - Host Operating System: Windows (release); Linux x86_64 (main)
- Lenguaje dominante
- C++
- Estrellas
- 3.7k
- Forks
- 926
- Merge medio
- 3 d 22 h
- PR fusionados (30 d)
- 45
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/DirectXShaderCompiler
-
bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/DirectXShaderCompiler#9173 ·
Los mantenedores suelen responder en 2 días
-
bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
microsoft/DirectXShaderCompiler#9155 · 4 comentarios ·
Los mantenedores suelen responder en 2 días
-
bug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/DirectXShaderCompiler#9135 ·
Los mantenedores suelen responder en 2 días
-
DXC emits DW_LANG_C_plus_plus instead of DW_LANG_HLSL for HLSLPosiblemente ocupada @rj123-nv la tomó hace 18 días. Abiertobug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
microsoft/DirectXShaderCompiler#9087 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
microsoft/DirectXShaderCompiler#9086 ·
Los mantenedores suelen responder en 2 días
Todos los issues de microsoft/DirectXShaderCompiler
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
feature:config kind:docs os:windows toolchain:cmake triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
arch-based bug niri
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
noctalia-dev/noctalia#5552 ·
Los mantenedores suelen responder en 1 día