[FFmpeg-devel] [PATCH]Avoid non-strict pointer aliasing in kega decoder
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Mon Mar 4 20:35:14 CET 2013
On Mon, Mar 04, 2013 at 08:49:36AM +0000, Carl Eugen Hoyos wrote:
> Reimar Döffinger <Reimar.Doeffinger <at> gmx.de> writes:
>
> > >With my current patch, the for loop looks like this:
> > > for (i = inp_off; i < count + inp_off; i++) {
> > > memcpy(&out[2 * outcnt++], &inp[2 * i], 2);
> > > }
> > >
> > >When I change that to memcpy:
> > > memcpy(&out[2 * outcnt], &inp[2 * inp_off], 2 * count);
> > > outcnt += count;
> > >
> > >I see ugly artefacts.
> >
> > Maybe inp and out can overlap? Try memmove.
>
> They often overlap and memmove would change
> the functionality.
>
> Is the last patch ok or are there still changes
> needed?
I don't mind much, but a 2-byte memcpy isn't great.
Also it would be better to figure out why AV_COPY16 isn't working...
Lastly, I think the copy should be made to use memcpy when
it makes sense, something along the lines of the attached
untested patch.
(needs a few *2 to work on top of your patch).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kgvcopy.diff
Type: text/x-diff
Size: 1548 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130304/4b7d4b10/attachment.bin>
More information about the ffmpeg-devel
mailing list