[Mesa-dev] [PATCH 27/34] glsl: Make sure that we don't put too many bitfields in ast_type_qualifier.

Paul Berry stereotype441 at gmail.com
Sun Jul 28 23:03:53 PDT 2013


From: Eric Anholt <eric at anholt.net>

We do some tests of qualifiers using a union containing an int and the
struct full of bitfields, so make sure the bitfields don't spill
outside the int.
---
 src/glsl/ast_to_hir.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 1d80e6b..3cfa1a4 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1936,6 +1936,8 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
 				 bool ubo_qualifiers_valid,
                                  bool is_parameter)
 {
+   STATIC_ASSERT(sizeof(qual->flags.q) <= sizeof(qual->flags.i));
+
    if (qual->flags.q.invariant) {
       if (var->used) {
 	 _mesa_glsl_error(loc, state,
-- 
1.8.3.4



More information about the mesa-dev mailing list