Skip to content

Commit

Permalink
[codec,progressive] prevent write at NULL
Browse files Browse the repository at this point in the history
When RFX_CONTEXT_PRIV::UseThreads is set to 0,
progressive_process_tiles() function will not attempt
to write at memory address 0.
  • Loading branch information
alega-kas committed Dec 25, 2023
1 parent 87557b1 commit 1a6a456
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions libfreerdp/codec/progressive.c
Original file line number Diff line number Diff line change
Expand Up @@ -1771,14 +1771,13 @@ static INLINE SSIZE_T progressive_process_tiles(PROGRESSIVE_CONTEXT* progressive
for (index = 0; index < region->numTiles; index++)
{
RFX_PROGRESSIVE_TILE* tile = region->tiles[index];
PROGRESSIVE_TILE_PROCESS_WORK_PARAM* param = &params[index];
param->progressive = progressive;
param->region = region;
param->context = context;
param->tile = tile;

if (progressive->rfx_context->priv->UseThreads)
{
params[index].progressive = progressive;
params[index].region = region;
params[index].context = context;
params[index].tile = tile;
if (!(work_objects[index] = CreateThreadpoolWork(
progressive_process_tiles_tile_work_callback, (void*)&params[index],
&progressive->rfx_context->priv->ThreadPoolEnv)))
Expand All @@ -1793,7 +1792,13 @@ static INLINE SSIZE_T progressive_process_tiles(PROGRESSIVE_CONTEXT* progressive
}
else
{
progressive_process_tiles_tile_work_callback(0, &params[index], 0);
PROGRESSIVE_TILE_PROCESS_WORK_PARAM param = {
.progressive = progressive,
.region = region,
.context = context,
.tile = tile
};
progressive_process_tiles_tile_work_callback(0, &param, 0);
}

if (status < 0)
Expand Down

0 comments on commit 1a6a456

Please sign in to comment.