diff mbox

[FFmpeg-devel,3/3] lavf/aviobuf: return EINVAL when reading from a write-only context.

Message ID 20171025082258.32530-3-george@nsup.org
State Superseded
Headers show

Commit Message

Nicolas George Oct. 25, 2017, 8:22 a.m. UTC
Signed-off-by: Nicolas George <george@nsup.org>
---
 libavformat/aviobuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


Not related to the issue, but seems more correct.

Comments

Hendrik Leppkes Oct. 25, 2017, 9:20 a.m. UTC | #1
On Wed, Oct 25, 2017 at 10:22 AM, Nicolas George <george@nsup.org> wrote:
> Signed-off-by: Nicolas George <george@nsup.org>
> ---
>  libavformat/aviobuf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
>
> Not related to the issue, but seems more correct.
>
>
> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
> index bb5bcf7a14..dfe8437b18 100644
> --- a/libavformat/aviobuf.c
> +++ b/libavformat/aviobuf.c
> @@ -534,7 +534,7 @@ static int read_packet_wrapper(AVIOContext *s, uint8_t *buf, int size)
>  #if FF_API_OLD_AVIO_EOF_0
>      if (!ret && !s->max_packet_size) {
>          av_log(s, AV_LOG_WARNING, "Invalid return value 0 for stream protocol\n");
> -        ret = AVERROR_EOF;
> +        ret = AVERROR(EINVAL);
>      }
>  #else
>      av_assert2(ret || s->max_packet_size);
> --

I think you meant to change the other ret assignment?

- Hendrik
Nicolas George Oct. 25, 2017, 9:22 a.m. UTC | #2
Le quartidi 4 brumaire, an CCXXVI, Hendrik Leppkes a écrit :
> I think you meant to change the other ret assignment?

You are entirely right. Locally swapped. Thanks for noticing.

Regards,
diff mbox

Patch

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index bb5bcf7a14..dfe8437b18 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -534,7 +534,7 @@  static int read_packet_wrapper(AVIOContext *s, uint8_t *buf, int size)
 #if FF_API_OLD_AVIO_EOF_0
     if (!ret && !s->max_packet_size) {
         av_log(s, AV_LOG_WARNING, "Invalid return value 0 for stream protocol\n");
-        ret = AVERROR_EOF;
+        ret = AVERROR(EINVAL);
     }
 #else
     av_assert2(ret || s->max_packet_size);