diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
index cf9df8c977caf64defc0d6f38282acd6d45298bb..caf29a8f6c185a5f9004ca374c41aef4c30ef3ee 100644
--- a/libavformat/jvdec.c
+++ b/libavformat/jvdec.c
@@ -184,6 +184,9 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
         }
     }
 
+    if (s->pb->eof_reached)
+        return AVERROR_EOF;
+
     return AVERROR(EIO);
 }