mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 14:57:20 +00:00
[host] dxgi: fix potential buffer out of bounds access
This commit is contained in:
parent
d480b674ca
commit
084ebe5035
@ -151,7 +151,7 @@ static const char * DXGI_FORMAT_STR[] = {
|
|||||||
|
|
||||||
const char * getDXGIFormatStr(DXGI_FORMAT format)
|
const char * getDXGIFormatStr(DXGI_FORMAT format)
|
||||||
{
|
{
|
||||||
if (format > sizeof(DXGI_FORMAT_STR) / sizeof(const char *))
|
if (format >= sizeof(DXGI_FORMAT_STR) / sizeof(const char *))
|
||||||
return DXGI_FORMAT_STR[0];
|
return DXGI_FORMAT_STR[0];
|
||||||
return DXGI_FORMAT_STR[format];
|
return DXGI_FORMAT_STR[format];
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ const char * getDXGIColorSpaceTypeStr(DXGI_COLOR_SPACE_TYPE type)
|
|||||||
if (type == DXGI_COLOR_SPACE_CUSTOM)
|
if (type == DXGI_COLOR_SPACE_CUSTOM)
|
||||||
return "DXGI_COLOR_SPACE_CUSTOM";
|
return "DXGI_COLOR_SPACE_CUSTOM";
|
||||||
|
|
||||||
if (type > sizeof(DXGI_COLOR_SPACE_TYPE_STR) / sizeof(const char *))
|
if (type >= sizeof(DXGI_COLOR_SPACE_TYPE_STR) / sizeof(const char *))
|
||||||
return "Invalid or Unknown";
|
return "Invalid or Unknown";
|
||||||
|
|
||||||
return DXGI_COLOR_SPACE_TYPE_STR[type];
|
return DXGI_COLOR_SPACE_TYPE_STR[type];
|
||||||
|
Loading…
Reference in New Issue
Block a user