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 Jan 9, 2024
1 parent 17635aa commit ec3b7a2
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions libfreerdp/codec/progressive.c
Original file line number Diff line number Diff line change
Expand Up @@ -1796,13 +1796,13 @@ static INLINE int progressive_process_tiles(PROGRESSIVE_CONTEXT* progressive, wS
for (index = 0; index < region->numTiles; index++)
{
RFX_PROGRESSIVE_TILE* tile = region->tiles[index];
params[index].progressive = progressive;
params[index].region = region;
params[index].context = context;
params[index].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 @@ -1817,7 +1817,13 @@ static INLINE int progressive_process_tiles(PROGRESSIVE_CONTEXT* progressive, wS
}
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 ec3b7a2

Please sign in to comment.