Skip to content

Commit

Permalink
Protect against empty arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
gavazquez committed Oct 19, 2018
1 parent 4f42bca commit 2a9a98e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CachedQuickLz/CachedQlzCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public static int SizeCompressed(byte[] source)
/// <returns>If the array is compressed with QuickLz or not</returns>
public static bool IsCompressed(byte[] source, int length)
{
if (source == null || source.Length < QlzConstants.QlzTrailLength || length < QlzConstants.QlzTrailLength)
return false;

var trailEquals = true;
for (var i = length - 1; i > length - QlzConstants.QlzTrailLength; i--)
{
Expand Down

0 comments on commit 2a9a98e

Please sign in to comment.