Skip to content

Commit

Permalink
Update Inflate.cs
Browse files Browse the repository at this point in the history
Security fix regarding nullable checks.
  • Loading branch information
GitHubProUser67 authored Dec 9, 2024
1 parent ca1a851 commit fe8c3ca
Showing 1 changed file with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,30 +338,31 @@ internal int inflateSync(ZStream z)
int num;
if ((num = z.avail_in) == 0)
return -5;
int num2 = z.next_in_index;
int num3 = z.istate.marker;
if (z.next_in != null)
else if (z.next_in != null)
{
int num2 = z.next_in_index;
int num3 = z.istate.marker;
while (num != 0 && num3 < 4)
{
num3 = ((z.next_in[num2] != mark[num3]) ? ((z.next_in[num2] == 0) ? (4 - num3) : 0) : (num3 + 1));
num2++;
num--;
}
z.total_in += num2 - z.next_in_index;
z.next_in_index = num2;
z.avail_in = num;
z.istate.marker = num3;
if (num3 != 4)
return -3;
long total_in = z.total_in;
long total_out = z.total_out;
inflateReset(z);
z.total_in = total_in;
z.total_out = total_out;
z.istate.mode = 7;
return 0;
}
z.total_in += num2 - z.next_in_index;
z.next_in_index = num2;
z.avail_in = num;
z.istate.marker = num3;
if (num3 != 4)
return -3;
long total_in = z.total_in;
long total_out = z.total_out;
inflateReset(z);
z.total_in = total_in;
z.total_out = total_out;
z.istate.mode = 7;
return 0;
return -1;
}

internal int inflateSyncPoint(ZStream z)
Expand All @@ -371,4 +372,4 @@ internal int inflateSyncPoint(ZStream z)
return z.istate.blocks.sync_point();
}
}
}
}

0 comments on commit fe8c3ca

Please sign in to comment.