~ubuntu-branches/ubuntu/precise/mesa/precise-security

« back to all changes in this revision

Viewing changes to src/glsl/loop_analysis.cpp

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers, Steve Beattie
  • Date: 2012-10-19 09:04:04 UTC
  • mfrom: (163.1.4 precise-proposed)
  • Revision ID: package-import@ubuntu.com-20121019090404-5zbjpsp6knv7zl3b
Tags: 8.0.4-0ubuntu0.2
[ Steve Beattie ]
* SECURITY UPDATE: samplers array overflow (LP: #1046933)
  - debian/patches/50-CVE-2012-2864.patch: ensure that more than
    MAX_SAMPLERS are not used
  - CVE-2012-2864

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
   virtual ir_visitor_status visit(ir_loop_jump *);
111
111
   virtual ir_visitor_status visit(ir_dereference_variable *);
112
112
 
 
113
   virtual ir_visitor_status visit_enter(ir_call *);
 
114
 
113
115
   virtual ir_visitor_status visit_enter(ir_loop *);
114
116
   virtual ir_visitor_status visit_leave(ir_loop *);
115
117
   virtual ir_visitor_status visit_enter(ir_assignment *);
153
155
 
154
156
 
155
157
ir_visitor_status
 
158
loop_analysis::visit_enter(ir_call *ir)
 
159
{
 
160
   /* If we're not somewhere inside a loop, there's nothing to do. */
 
161
   if (this->state.is_empty())
 
162
      return visit_continue;
 
163
 
 
164
   loop_variable_state *const ls =
 
165
      (loop_variable_state *) this->state.get_head();
 
166
 
 
167
   ls->contains_calls = true;
 
168
   return visit_continue_with_parent;
 
169
}
 
170
 
 
171
 
 
172
ir_visitor_status
156
173
loop_analysis::visit(ir_dereference_variable *ir)
157
174
{
158
175
   /* If we're not somewhere inside a loop, there's nothing to do.
209
226
   loop_variable_state *const ls =
210
227
      (loop_variable_state *) this->state.pop_head();
211
228
 
 
229
   /* Function calls may contain side effects.  These could alter any of our
 
230
    * variables in ways that cannot be known, and may even terminate shader
 
231
    * execution (say, calling discard in the fragment shader).  So we can't
 
232
    * rely on any of our analysis about assignments to variables.
 
233
    *
 
234
    * We could perform some conservative analysis (prove there's no statically
 
235
    * possible assignment, etc.) but it isn't worth it for now; function
 
236
    * inlining will allow us to unroll loops anyway.
 
237
    */
 
238
   if (ls->contains_calls)
 
239
      return visit_continue;
212
240
 
213
241
   foreach_list(node, &ir->body_instructions) {
214
242
      /* Skip over declarations at the start of a loop.