mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(ElgFormat.Reader): moved output bounds check into loop body.
This commit is contained in:
@@ -155,10 +155,10 @@ namespace GameRes.Formats.Lucifen
|
|||||||
void UnpackIndexed (byte[] output)
|
void UnpackIndexed (byte[] output)
|
||||||
{
|
{
|
||||||
int dst = 0;
|
int dst = 0;
|
||||||
while (dst < m_output.Length)
|
for (;;)
|
||||||
{
|
{
|
||||||
byte flags = m_input.ReadByte();
|
byte flags = m_input.ReadByte();
|
||||||
if (0xff == flags)
|
if (0xff == flags || dst >= m_output.Length)
|
||||||
break;
|
break;
|
||||||
int count, pos;
|
int count, pos;
|
||||||
|
|
||||||
@@ -228,10 +228,10 @@ namespace GameRes.Formats.Lucifen
|
|||||||
void UnpackRGBA ()
|
void UnpackRGBA ()
|
||||||
{
|
{
|
||||||
int dst = 0;
|
int dst = 0;
|
||||||
while (dst < m_output.Length)
|
for (;;)
|
||||||
{
|
{
|
||||||
byte flags = m_input.ReadByte();
|
byte flags = m_input.ReadByte();
|
||||||
if (0xff == flags)
|
if (0xff == flags || dst >= m_output.Length)
|
||||||
break;
|
break;
|
||||||
int count, pos, src;
|
int count, pos, src;
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ namespace GameRes.Formats.Lucifen
|
|||||||
if (0 != (flags & 0x20))
|
if (0 != (flags & 0x20))
|
||||||
count = ((flags & 0x1f) << 8) + m_input.ReadByte() + 34;
|
count = ((flags & 0x1f) << 8) + m_input.ReadByte() + 34;
|
||||||
else
|
else
|
||||||
count = (flags & 0x1f) + 2;
|
count = (flags & 0x1f) + 2;
|
||||||
|
|
||||||
byte b = m_input.ReadByte();
|
byte b = m_input.ReadByte();
|
||||||
byte g = m_input.ReadByte();
|
byte g = m_input.ReadByte();
|
||||||
@@ -354,10 +354,10 @@ namespace GameRes.Formats.Lucifen
|
|||||||
public void UnpackAlpha ()
|
public void UnpackAlpha ()
|
||||||
{
|
{
|
||||||
int dst = 3;
|
int dst = 3;
|
||||||
while (dst < m_output.Length)
|
for (;;)
|
||||||
{
|
{
|
||||||
byte flags = m_input.ReadByte();
|
byte flags = m_input.ReadByte();
|
||||||
if (0xff == flags)
|
if (0xff == flags || dst >= m_output.Length)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
int count, pos;
|
int count, pos;
|
||||||
@@ -439,10 +439,10 @@ namespace GameRes.Formats.Lucifen
|
|||||||
void UnpackRGB ()
|
void UnpackRGB ()
|
||||||
{
|
{
|
||||||
int dst = 0;
|
int dst = 0;
|
||||||
while (dst < m_output.Length)
|
for (;;)
|
||||||
{
|
{
|
||||||
byte flags = m_input.ReadByte();
|
byte flags = m_input.ReadByte();
|
||||||
if (0xff == flags)
|
if (0xff == flags || dst >= m_output.Length)
|
||||||
break;
|
break;
|
||||||
int count, pos, src;
|
int count, pos, src;
|
||||||
if (0 == (flags & 0xc0))
|
if (0 == (flags & 0xc0))
|
||||||
|
|||||||
Reference in New Issue
Block a user