Merge pull request #4224 from krisztian-kovacs-balabit/nsc-memory-corruption-fix
codec/nsc: fix memory corruption in case of chroma subsampling
This commit is contained in:
commit
7717a42f6c
@ -237,9 +237,13 @@ static void nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, const BYTE* data,
|
||||
|
||||
if (context->ChromaSubsamplingLevel && (y % 2) == 1)
|
||||
{
|
||||
CopyMemory(yplane + rw, yplane, rw);
|
||||
CopyMemory(coplane + rw, coplane, rw);
|
||||
CopyMemory(cgplane + rw, cgplane, rw);
|
||||
yplane = context->priv->PlaneBuffers[0] + y * rw;
|
||||
coplane = context->priv->PlaneBuffers[1] + y * rw;
|
||||
cgplane = context->priv->PlaneBuffers[2] + y * rw;
|
||||
|
||||
CopyMemory(yplane, yplane - rw, rw);
|
||||
CopyMemory(coplane, coplane - rw, rw);
|
||||
CopyMemory(cgplane, cgplane - rw, rw);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -326,9 +326,13 @@ static void nsc_encode_argb_to_aycocg_sse2(NSC_CONTEXT* context,
|
||||
|
||||
if (context->ChromaSubsamplingLevel > 0 && (y % 2) == 1)
|
||||
{
|
||||
CopyMemory(yplane + rw, yplane, rw);
|
||||
CopyMemory(coplane + rw, coplane, rw);
|
||||
CopyMemory(cgplane + rw, cgplane, rw);
|
||||
yplane = context->priv->PlaneBuffers[0] + y * rw;
|
||||
coplane = context->priv->PlaneBuffers[1] + y * rw;
|
||||
cgplane = context->priv->PlaneBuffers[2] + y * rw;
|
||||
|
||||
CopyMemory(yplane, yplane - rw, rw);
|
||||
CopyMemory(coplane, coplane - rw, rw);
|
||||
CopyMemory(cgplane, cgplane - rw, rw);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user