diff --git a/modules/demux/mjpeg.c b/modules/demux/mjpeg.c
index d688a9b46a58ef56b8ad325e680156ea10fdce11..a66f3871f5818964d722a84820231c7e68f4cd20 100644
--- a/modules/demux/mjpeg.c
+++ b/modules/demux/mjpeg.c
@@ -344,7 +344,8 @@ static int Open( vlc_object_t * p_this )
     if( b_matched )
     {
         p_demux->pf_demux = MimeDemux;
-        vlc_stream_Read( p_demux->s, NULL, i_size );
+        if( vlc_stream_Read( p_demux->s, NULL, i_size ) < i_size )
+            goto error;
     }
     else if( i_size == 0 )
     {