File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -844,7 +844,10 @@ static int packfile_unpack_compressed(
844844 unsigned int window_len ;
845845 unsigned char * in ;
846846
847- in = pack_window_open (p , mwindow , * position , & window_len );
847+ if ((in = pack_window_open (p , mwindow , * position , & window_len )) == NULL ) {
848+ error = -1 ;
849+ goto out ;
850+ }
848851
849852 if ((error = git_zstream_set_input (& zstream , in , window_len )) < 0 ||
850853 (error = git_zstream_get_output_chunk (data + total , & bytes , & zstream )) < 0 ) {
@@ -854,9 +857,12 @@ static int packfile_unpack_compressed(
854857
855858 git_mwindow_close (mwindow );
856859
860+ if (!bytes )
861+ break ;
862+
857863 * position += window_len - zstream .in_len ;
858864 total += bytes ;
859- } while (total < size );
865+ } while (! git_zstream_eos ( & zstream ) );
860866
861867 if (total != size || !git_zstream_eos (& zstream )) {
862868 git_error_set (GIT_ERROR_ZLIB , "error inflating zlib stream" );
You can’t perform that action at this time.
0 commit comments