Commit ce57e5c4 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

mstask: Correctly initialize trigger count when loading a task.

parent 8d7d858d
......@@ -968,17 +968,17 @@ static HRESULT load_job_data(TaskImpl *This, BYTE *data, DWORD size)
TRACE("trigger_offset %04x, triggers end at %04x\n", fixed->trigger_offset,
(DWORD)(fixed->trigger_offset + sizeof(USHORT) + trigger_count * sizeof(TASK_TRIGGER)));
This->trigger_count = *(const USHORT *)data;
TRACE("trigger_count %u\n", trigger_count);
task_trigger = (TASK_TRIGGER *)(data + sizeof(USHORT));
if (This->trigger_count * sizeof(TASK_TRIGGER) > triggers_size)
if (trigger_count * sizeof(TASK_TRIGGER) > triggers_size)
{
TRACE("no space for triggers data\n");
return SCHED_E_INVALID_TASK;
}
for (i = 0; i < This->trigger_count; i++)
This->trigger_count = 0;
for (i = 0; i < trigger_count; i++)
{
ITaskTrigger *trigger;
WORD idx;
......@@ -995,8 +995,8 @@ static HRESULT load_job_data(TaskImpl *This, BYTE *data, DWORD size)
}
}
size -= sizeof(USHORT) + This->trigger_count * sizeof(TASK_TRIGGER);
data += sizeof(USHORT) + This->trigger_count * sizeof(TASK_TRIGGER);
size -= sizeof(USHORT) + trigger_count * sizeof(TASK_TRIGGER);
data += sizeof(USHORT) + trigger_count * sizeof(TASK_TRIGGER);
if (size < 2 * sizeof(USHORT) + 64)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment