mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-24 03:00:30 +01:00
llvmpipe: Asserts that the format at least has one non-void channel
As we are using its index as array index, avoid the use of the -1 index there. CID: 1517247, 1517239 Negative array index read Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35091>
This commit is contained in:
parent
d2aade9184
commit
09938eee85
1 changed files with 3 additions and 1 deletions
|
|
@ -181,6 +181,7 @@ lp_mem_type_from_format_desc(const struct util_format_description *format_desc,
|
|||
}
|
||||
|
||||
int chan = util_format_get_first_non_void_channel(format_desc->format);
|
||||
assert(chan >= 0);
|
||||
|
||||
memset(type, 0, sizeof(struct lp_type));
|
||||
type->floating = format_desc->channel[chan].type == UTIL_FORMAT_TYPE_FLOAT;
|
||||
|
|
@ -1783,7 +1784,8 @@ lp_blend_type_from_format_desc(const struct util_format_description *format_desc
|
|||
return;
|
||||
}
|
||||
|
||||
const int chan = util_format_get_first_non_void_channel(format_desc->format);
|
||||
int chan = util_format_get_first_non_void_channel(format_desc->format);
|
||||
assert(chan >= 0);
|
||||
|
||||
memset(type, 0, sizeof(struct lp_type));
|
||||
type->floating = format_desc->channel[chan].type == UTIL_FORMAT_TYPE_FLOAT;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue