mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Ensure compressed* WebGL functions don't allow disabled formats
This commit is contained in:
parent
044ac2dd28
commit
2bf35881f9
Notes:
github-actions[bot]
2025-11-06 18:04:31 +00:00
Author: https://github.com/cqundefine
Commit: 2bf35881f9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6711
Reviewed-by: https://github.com/awesomekling
3 changed files with 30 additions and 0 deletions
|
|
@ -1195,6 +1195,11 @@ void WebGL2RenderingContextImpl::compressed_tex_image3d(WebIDL::UnsignedLong tar
|
|||
{
|
||||
m_context->make_current();
|
||||
|
||||
if (!enabled_compressed_texture_formats().contains_slow(internalformat)) {
|
||||
set_error(GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
|
||||
auto pixels = SET_ERROR_VALUE_IF_ERROR(get_offset_span<u8 const>(*src_data, src_offset, src_length_override), GL_INVALID_VALUE);
|
||||
glCompressedTexImage3DRobustANGLE(target, level, internalformat, width, height, depth, border, pixels.size(), pixels.size(), pixels.data());
|
||||
}
|
||||
|
|
@ -1203,6 +1208,11 @@ void WebGL2RenderingContextImpl::compressed_tex_sub_image3d(WebIDL::UnsignedLong
|
|||
{
|
||||
m_context->make_current();
|
||||
|
||||
if (!enabled_compressed_texture_formats().contains_slow(format)) {
|
||||
set_error(GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
|
||||
auto pixels = SET_ERROR_VALUE_IF_ERROR(get_offset_span<u8 const>(*src_data, src_offset, src_length_override), GL_INVALID_VALUE);
|
||||
glCompressedTexSubImage3DRobustANGLE(target, level, xoffset, yoffset, zoffset, width, height, depth, format, pixels.size(), pixels.size(), pixels.data());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,6 +166,11 @@ void WebGL2RenderingContextOverloads::compressed_tex_image2d(WebIDL::UnsignedLon
|
|||
{
|
||||
m_context->make_current();
|
||||
|
||||
if (!enabled_compressed_texture_formats().contains_slow(internalformat)) {
|
||||
set_error(GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
|
||||
auto pixels = SET_ERROR_VALUE_IF_ERROR(get_offset_span<u8 const>(*src_data, src_offset, src_length_override), GL_INVALID_VALUE);
|
||||
glCompressedTexImage2DRobustANGLE(target, level, internalformat, width, height, border, pixels.size(), pixels.size(), pixels.data());
|
||||
}
|
||||
|
|
@ -174,6 +179,11 @@ void WebGL2RenderingContextOverloads::compressed_tex_sub_image2d(WebIDL::Unsigne
|
|||
{
|
||||
m_context->make_current();
|
||||
|
||||
if (!enabled_compressed_texture_formats().contains_slow(format)) {
|
||||
set_error(GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
|
||||
auto pixels = SET_ERROR_VALUE_IF_ERROR(get_offset_span<u8 const>(*src_data, src_offset, src_length_override), GL_INVALID_VALUE);
|
||||
glCompressedTexSubImage2DRobustANGLE(target, level, xoffset, yoffset, width, height, format, pixels.size(), pixels.size(), pixels.data());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,11 @@ void WebGLRenderingContextOverloads::compressed_tex_image2d(WebIDL::UnsignedLong
|
|||
{
|
||||
m_context->make_current();
|
||||
|
||||
if (!enabled_compressed_texture_formats().contains_slow(internalformat)) {
|
||||
set_error(GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
|
||||
auto span = MUST(get_offset_span<u8 const>(*data, /* src_offset= */ 0));
|
||||
glCompressedTexImage2DRobustANGLE(target, level, internalformat, width, height, border, span.size(), span.size(), span.data());
|
||||
}
|
||||
|
|
@ -61,6 +66,11 @@ void WebGLRenderingContextOverloads::compressed_tex_sub_image2d(WebIDL::Unsigned
|
|||
{
|
||||
m_context->make_current();
|
||||
|
||||
if (!enabled_compressed_texture_formats().contains_slow(format)) {
|
||||
set_error(GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
|
||||
auto span = MUST(get_offset_span<u8 const>(*data, /* src_offset= */ 0));
|
||||
glCompressedTexSubImage2DRobustANGLE(target, level, xoffset, yoffset, width, height, format, span.size(), span.size(), span.data());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue