Null dereference due to not checking return value of util_format_description
https://bugs.freedesktop.org/show_bug.cgi?id=102552
Bug ID: 102552
Summary: Null dereference due to not checking return value of
util_format_description
Product: Mesa
Version: git
Hardware: x86-64 (AMD64)
OS: All
Status: NEW
Severity: enhancement
Priority: medium
Component: Drivers/Gallium/r600
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
In case unsupported format util_format_description return NULL, and dereference will produce segffault.
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
https://bugs.freedesktop.org/show_bug.cgi?id=102552
Pauk Denis <[email protected]> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #1 from Pauk Denis <[email protected]> --- Created attachment 133978
--> https://bugs.freedesktop.org/attachment.cgi?id=133978&action=edit
gallium/{r600,radeonsi}: Fix segfault with color format
Possible fix for r600/radionsi
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
https://bugs.freedesktop.org/show_bug.cgi?id=102552
--- Comment #2 from Ilia Mirkin <[email protected]> ---
What format is this happening with? There should be a description for every format, maybe except PIPE_FORMAT_NONE.
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
https://bugs.freedesktop.org/show_bug.cgi?id=102552
--- Comment #3 from Pauk Denis <[email protected]> ---
I have found this behaiviour because of error in my code when some time is_format_supported called with uninitialized value and had value > PIPE_FORMAT_COUNT.
With check like:
-----for(int i=0; i<PIPE_FORMAT_COUNT; i++) {
pscreen->is_format_supported(pscreen, i, PIPE_TEXTURE_2D, 0,PIPE_BIND_SAMPLER_VIEW);
}
-----
Such code has possible issues with: 73, 78, 79, 80, 81, 86 (holes in enum pipe_format).
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
https://bugs.freedesktop.org/show_bug.cgi?id=102552
--- Comment #4 from Ilia Mirkin <[email protected]> ---
Oh interesting. I think some of those formats were removed recently. I wonder if such call sites should be fixed. Nouveau calls util_format_is_supported up high in is_format_supported, I suspect that gets it out of trouble.
Either way, is_format_supported or its callers should be fixed, not utility functions like util_format_get_first_non_void_channel.
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
https://bugs.freedesktop.org/show_bug.cgi?id=102552
Pauk Denis <[email protected]> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #133978|0 |1
is obsolete| |
--- Comment #5 from Pauk Denis <[email protected]> --- Created attachment 134056
--> https://bugs.freedesktop.org/attachment.cgi?id=134056&action=edit
Updated version with changes related only to *_supported functions.
I have deleted all changes not realted to *_supported functions.
Change in src/gallium/auxiliary/util/u_format.c:util_format_is_supported - check that value of format in correct range (<PIPE_FORMAT_COUNT).
Changes in src/gallium/drivers/{r600,radeonsi} - check for holes in format values.
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
https://bugs.freedesktop.org/show_bug.cgi?id=102552
Pauk Denis <[email protected]> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #134056|0 |1
is obsolete| |
--- Comment #6 from Pauk Denis <[email protected]> --- Created attachment 134129
--> https://bugs.freedesktop.org/attachment.cgi?id=134129&action=edit
gallium/{r600,radeonsi}: Fix segfault with color format
Fix radeonsi
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
https://bugs.freedesktop.org/show_bug.cgi?id=102552
--- Comment #7 from Pauk Denis <[email protected]> ---
In 'si_is_sampler_format_supported': 'util_format_get_first_non_void_channel' - tried to check 'struct util_format_description' before 'si_translate_texformat' call so we have segfault before check.
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
https://bugs.freedesktop.org/show_bug.cgi?id=102552
--- Comment #8 from Pauk Denis <[email protected]> --- I have sent version patch to [email protected].
https://patchwork.freedesktop.org/series/30086/
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
https://bugs.freedesktop.org/show_bug.cgi?id=102552
Pauk Denis <[email protected]> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED--- Comment #9 from Pauk Denis <[email protected]> --- Fixed in
https://cgit.freedesktop.org/mesa/mesa/commit/?id=74d2456491fbd96eb3fb99cf8dd3595b223c2065
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel