Message ID | 20200104185249.8563-1-george@nsup.org |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] lavu/buffer: forward av_buffer_realloc() error code. | expand |
Context | Check | Description |
---|---|---|
andriy/ffmpeg-patchwork | success | Make fate finished |
Nicolas George: > Fix CID 1457235. > > Signed-off-by: Nicolas George <george@nsup.org> > --- > libavutil/buffer.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/libavutil/buffer.c b/libavutil/buffer.c > index 6d9cb7428e..2f33e5ebb6 100644 > --- a/libavutil/buffer.c > +++ b/libavutil/buffer.c > @@ -171,6 +171,7 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) > { > AVBufferRef *buf = *pbuf; > uint8_t *tmp; > + int ret; > > if (!buf) { > /* allocate a new buffer with av_realloc(), so it will be reallocatable > @@ -197,9 +198,9 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) > /* cannot realloc, allocate a new reallocable buffer and copy data */ > AVBufferRef *new = NULL; > > - av_buffer_realloc(&new, size); > + ret = av_buffer_realloc(&new, size); > if (!new) Shouldn't you check for (ret < 0) instead of (!new)? I am unsure whether Coverity will really count this as a fix. - Andreas > - return AVERROR(ENOMEM); > + return ret; > > memcpy(new->data, buf->data, FFMIN(size, buf->size)); > >
On 1/4/20, Nicolas George <george@nsup.org> wrote: > Fix CID 1457235. > > Signed-off-by: Nicolas George <george@nsup.org> > --- > libavutil/buffer.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/libavutil/buffer.c b/libavutil/buffer.c > index 6d9cb7428e..2f33e5ebb6 100644 > --- a/libavutil/buffer.c > +++ b/libavutil/buffer.c > @@ -171,6 +171,7 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) > { > AVBufferRef *buf = *pbuf; > uint8_t *tmp; > + int ret; > > if (!buf) { > /* allocate a new buffer with av_realloc(), so it will be > reallocatable > @@ -197,9 +198,9 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) > /* cannot realloc, allocate a new reallocable buffer and copy data > */ > AVBufferRef *new = NULL; > > - av_buffer_realloc(&new, size); > + ret = av_buffer_realloc(&new, size); > if (!new) > - return AVERROR(ENOMEM); > + return ret; > > memcpy(new->data, buf->data, FFMIN(size, buf->size)); > > -- > 2.24.1 > OK > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Andreas Rheinhardt (12020-01-04): > Shouldn't you check for (ret < 0) instead of (!new)? I am unsure > whether Coverity will really count this as a fix. I hesitated and went for the minimalist patch. New version. Regards,
Nicolas George (12020-01-04): > From 8ef49a7c86e108ed9e6981d482ae892e6f62c0f5 Mon Sep 17 00:00:00 2001 > From: Nicolas George <george@nsup.org> > Date: Sat, 4 Jan 2020 19:52:08 +0100 > Subject: [PATCH 1/2] lavu/buffer: forward av_buffer_realloc() error code. > > Fix CID 1457235. > > Signed-off-by: Nicolas George <george@nsup.org> > --- > libavutil/buffer.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) Ping? Will apply next time I think about it if nobody objects and it still applies. Regards,
Nicolas George (12020-08-09): > Ping? Will apply next time I think about it if nobody objects and it > still applies. Pushed. Regards,
diff --git a/libavutil/buffer.c b/libavutil/buffer.c index 6d9cb7428e..2f33e5ebb6 100644 --- a/libavutil/buffer.c +++ b/libavutil/buffer.c @@ -171,6 +171,7 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) { AVBufferRef *buf = *pbuf; uint8_t *tmp; + int ret; if (!buf) { /* allocate a new buffer with av_realloc(), so it will be reallocatable @@ -197,9 +198,9 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size) /* cannot realloc, allocate a new reallocable buffer and copy data */ AVBufferRef *new = NULL; - av_buffer_realloc(&new, size); + ret = av_buffer_realloc(&new, size); if (!new) - return AVERROR(ENOMEM); + return ret; memcpy(new->data, buf->data, FFMIN(size, buf->size));
Fix CID 1457235. Signed-off-by: Nicolas George <george@nsup.org> --- libavutil/buffer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)