소스 검색

i965: fix problem with constant out of bounds access (v2)

This is my attempt at fixing this as the CVE is making RH security team
care enough to make me look at this. (please upstream, security fixes are
more important than whatever else you are doing, if for no other reason than
it saves me having to fix stuff I've no real clue about).

Since Frank's original fix was denied, here is my attempt to just
alias all constants that are out of bounds < 0 or > nr_params to constant 0,
hopefully this provides the undefined behaviour idr requires..

CVE-2013-1872

v2: drop the last hunk which was a separate fix (now in master).
hopefully fix the indentations.

NOTE: This is a candidate for stable branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
tags/mesa-9.2-rc1
Dave Airlie 12 년 전
부모
커밋
98dfd59a04
1개의 변경된 파일11개의 추가작업 그리고 1개의 파일을 삭제
  1. 11
    1
      src/mesa/drivers/dri/i965/brw_fs.cpp

+ 11
- 1
src/mesa/drivers/dri/i965/brw_fs.cpp 파일 보기

@@ -1504,7 +1504,13 @@ fs_visitor::remove_dead_constants()
if (inst->src[i].file != UNIFORM)
continue;

assert(constant_nr < (int)c->prog_data.nr_params);
/* if we get a negative constant nr or one greater than we can
* handle, this can cause an overflow, we can't just refuse to
* build, so just go undefined and alias everyone to constant 0.
*/
if (constant_nr < 0 || constant_nr >= (int)c->prog_data.nr_params) {
constant_nr = 0;
}

/* For now, set this to non-negative. We'll give it the
* actual new number in a moment, in order to keep the
@@ -1552,6 +1558,10 @@ fs_visitor::remove_dead_constants()
if (inst->src[i].file != UNIFORM)
continue;

/* as above alias to 0 */
if (constant_nr < 0 || constant_nr >= (int)c->prog_data.nr_params) {
constant_nr = 0;
}
assert(this->params_remap[constant_nr] != -1);
inst->src[i].reg = this->params_remap[constant_nr];
inst->src[i].reg_offset = 0;

Loading…
취소
저장