[cache,pointer] ignore pointer cache index violations

If a pointer cache index is out of range for the corresponding size
announced by the capability but within range of the total cache size
only print a warning but do not abort.
This commit is contained in:
akallabeth
2022-12-05 13:00:07 +01:00
committed by akallabeth
parent 6aa8253b6c
commit de175b7f38

View File

@@ -301,7 +301,7 @@ BOOL pointer_cache_put(rdpPointerCache* pointer_cache, UINT32 index, rdpPointer*
WINPR_ASSERT(pointer_cache->context);
const UINT32 size = freerdp_settings_get_uint32(pointer_cache->context->settings, id);
if ((index >= pointer_cache->cacheSize) || (index >= size))
if (index >= pointer_cache->cacheSize)
{
WLog_ERR(TAG,
"invalid pointer index:%" PRIu32 " [allocated %" PRIu32 ", %s size %" PRIu32 "]",
@@ -309,6 +309,14 @@ BOOL pointer_cache_put(rdpPointerCache* pointer_cache, UINT32 index, rdpPointer*
colorCache ? "color-pointer-cache" : "pointer-cache", size);
return FALSE;
}
if (index >= size)
{
WLog_WARN(TAG,
"suspicious pointer index:%" PRIu32 " [allocated %" PRIu32 ", %s size %" PRIu32
"]",
index, pointer_cache->cacheSize,
colorCache ? "color-pointer-cache" : "pointer-cache", size);
}
WINPR_ASSERT(pointer_cache->entries);
prevPointer = pointer_cache->entries[index];