[FFmpeg-devel] [PATCH] avutil/encryption_info: Don't pass NULL to memcpy

Michael Niedermayer michael at niedermayer.cc
Sat Sep 21 00:16:40 EEST 2019


On Wed, Sep 18, 2019 at 08:20:10PM +0200, Tomas Härdin wrote:
> ons 2019-09-18 klockan 02:03 +0200 skrev Andreas Rheinhardt:
> > The pointer arguments to memcpy (and several other functions of the
> > C standard library) are not allowed to be NULL, not even when the number
> > of bytes to copy is zero. An AVEncryptionInitInfo's data pointer is
> > explicitly allowed to be NULL and yet av_encryption_init_info_add_side_data
> > unconditionally used it as a source pointer to copy from. This commit changes
> > this so that copying is only done if the number of bytes to copy is > 0.
> 
> *gesticulates wildly with a formal verification stick*
> 
> > -        memcpy(cur_buffer, cur_info->data, cur_info->data_size);
> > -        cur_buffer += cur_info->data_size;
> > +        if (cur_info->data_size > 0) {
> > +            memcpy(cur_buffer, cur_info->data, cur_info->data_size);
> > +            cur_buffer += cur_info->data_size;
> > +        }
> 
> Approve

will apply

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190920/69d45a15/attachment.sig>


More information about the ffmpeg-devel mailing list