av: Fix compile errors

Don't use memcpy() on areas that may overlap
Fix aliasing violation

Change-Id: Icd54cf12c2485a3d2789d1fb75c3a8a964c4163f
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>