[libav-devel] [PATCH] avresample_buffer() input buffer should reassure caller read only.

Kip Warner kip at thevertigo.com
Fri Dec 11 23:26:03 CET 2015


On Fri, 2015-12-11 at 10:54 +0100, Luca Barbato wrote:
> On 11/12/15 01:50, Kip Warner wrote:
> > Hey folks,
> > 
> > Please find enclosed a patch to ensure avresample_buffer() caller's
> > input buffer will not be modified.
> > 
> > Although the task of patching all of libav for const correctness is
> > beyond my time at present, the attached is small patch to at least
> > allow libav client code to compile cleanly when calling
> > avresample_buffer() with an input buffer it needs to be reassured
> > will
> > not be modified.
> 
> This would require a cast or a suppression to handle
> 
> AudioData.data[] = src[]
> 
> In itself would be ok: AudioData has a read_only field and it is set
> for
> the input.
> 
> > From what I could see, the changes needed were only minor
> > syntactical,
> > so I hope there wasn't something more fundamental / deeper why
> > avresample_convert() could potentially need to tamper with the
> > input
> > buffer (e.g. dependent ff_audio_data_init's read_only parameter?).
> 
>     if (input) {
>         /* initialize input_buffer with input data */
>         ret = ff_audio_data_init(&input_buffer, input, in_plane_size,
>                                  avr->in_channels, in_samples,
>                                  avr->in_sample_fmt, 1, "input");
> 
> I would not expect issues.
> 
> Since it is a non-const -> const is sort of ok to fold it in.
> 
> Justin do you have opinions?
> 
> lu

Thanks Luca.

-- 
Kip Warner -- Senior Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.libav.org/pipermail/libav-devel/attachments/20151211/a444888f/attachment.sig>


More information about the libav-devel mailing list