Skip to content

Commit

Permalink
Fixed dictionary null access (haf#276)
Browse files Browse the repository at this point in the history
Fixes haf#200
  • Loading branch information
zii-dmg committed Jan 24, 2023
1 parent 1e52953 commit 42a096d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Zlib.Shared/Deflate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1667,12 +1667,12 @@ internal int SetParams(CompressionLevel level, CompressionStrategy strategy)

internal int SetDictionary(byte[] dictionary)
{
int length = dictionary.Length;
int index = 0;

if (dictionary == null || status != INIT_STATE)
throw new ZlibException("Stream error.");

int length = dictionary.Length;
int index = 0;

_codec._Adler32 = Adler.Adler32(_codec._Adler32, dictionary, 0, dictionary.Length);

if (length < MIN_MATCH)
Expand Down Expand Up @@ -1876,4 +1876,4 @@ internal int Deflate(FlushType flush)
}

}
}
}

0 comments on commit 42a096d

Please sign in to comment.