[coverity] fix warnings

This commit is contained in:
akallabeth
2024-08-26 09:10:43 +02:00
parent 2812775c96
commit 86e2789d9b
5 changed files with 32 additions and 7 deletions

View File

@@ -246,9 +246,11 @@ void* UwacClipboardDataGet(UwacSeat* seat, const char* mime, size_t* size)
do
{
void* tmp = NULL;
if (alloc >= SIZE_MAX - 1024)
goto fail;
alloc += 1024;
tmp = xrealloc(data, alloc);
void* tmp = xrealloc(data, alloc);
if (!tmp)
goto fail;

View File

@@ -78,6 +78,7 @@ static void UwacWindowDestroyBuffers(UwacWindow* w)
w->buffers = NULL;
}
WINPR_ATTR_MALLOC(UwacWindowDestroyBuffers, 1)
static int UwacWindowShmAllocBuffers(UwacWindow* w, int64_t nbuffers, int64_t allocSize,
uint32_t width, uint32_t height, enum wl_shm_format format);
@@ -331,7 +332,7 @@ int UwacWindowShmAllocBuffers(UwacWindow* w, int64_t nbuffers, int64_t allocSize
return UWAC_ERROR_NOMEMORY;
/* round up to a multiple of PAGESIZE to page align data for each buffer */
uint64_t test = (0ull + allocSize + pagesize - 1ull) & ~(pagesize - 1);
const uint64_t test = (1ull * allocSize + pagesize - 1ull) & ~(pagesize - 1);
if (test > INT64_MAX)
return UWAC_ERROR_NOMEMORY;