mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 20:40:39 +00:00
Exhumed: Always perform a range check on a sequence's length.
Too many of these are not correct and prone to overflows so ignoring this is not good.
This commit is contained in:
parent
8dfb21636a
commit
1cb15ed878
2 changed files with 7 additions and 3 deletions
|
@ -450,7 +450,7 @@ void seq_PlotArrowSequence(const int nSprite, const FName seqFile, const int16_t
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void seq_PlotSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int16_t frameIndex, const int16_t nFlags)
|
void seq_PlotSequence(const int nSprite, const FName seqFile, const int seqIndex, int frameIndex, const int nFlags)
|
||||||
{
|
{
|
||||||
tspritetype* pTSprite = mytspriteArray->get(nSprite);
|
tspritetype* pTSprite = mytspriteArray->get(nSprite);
|
||||||
const auto pPlayer = getPlayer(nLocalPlayer);
|
const auto pPlayer = getPlayer(nLocalPlayer);
|
||||||
|
@ -464,7 +464,11 @@ void seq_PlotSequence(const int nSprite, const FName seqFile, const int16_t seqI
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto fileSeqs = getFileSeqs(seqFile);
|
const auto fileSeqs = getFileSeqs(seqFile);
|
||||||
const auto& seqFrame = fileSeqs->Data(seqIndex + seqOffset)->frames[frameIndex];
|
if (seqIndex + seqOffset > fileSeqs->SSize()) return;
|
||||||
|
const auto& sequence = fileSeqs->Data(seqIndex + seqOffset);
|
||||||
|
if (sequence->frames.SSize() <= frameIndex) frameIndex = sequence->frames.SSize() - 1;
|
||||||
|
|
||||||
|
const auto& seqFrame = sequence->frames[frameIndex];
|
||||||
const auto chunkCount = seqFrame.chunks.Size();
|
const auto chunkCount = seqFrame.chunks.Size();
|
||||||
|
|
||||||
const auto nShade = pTSprite->shade - (100 * !!(fileSeqs->Data(seqIndex)->frames[frameIndex].flags & 4));
|
const auto nShade = pTSprite->shade - (100 * !!(fileSeqs->Data(seqIndex)->frames[frameIndex].flags & 4));
|
||||||
|
|
|
@ -80,7 +80,7 @@ extern int16_t nPilotLightCount;
|
||||||
|
|
||||||
void seq_LoadSequences();
|
void seq_LoadSequences();
|
||||||
void seq_DrawGunSequence(const SeqFrame& seqFrame, double xPos, double yPos, int nShade, int nPal, DAngle nAngle, double nAlpha, int nStat = 0);
|
void seq_DrawGunSequence(const SeqFrame& seqFrame, double xPos, double yPos, int nShade, int nPal, DAngle nAngle, double nAlpha, int nStat = 0);
|
||||||
void seq_PlotSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int16_t frameIndex, const int16_t nFlags);
|
void seq_PlotSequence(const int nSprite, const FName seqFile, const int seqIndex, int frameIndex, const int nFlags);
|
||||||
void seq_PlotArrowSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int frameIndex);
|
void seq_PlotArrowSequence(const int nSprite, const FName seqFile, const int16_t seqIndex, const int frameIndex);
|
||||||
void seq_DrawPilotLightSeq(double xPos, double yPos, double nAngle);
|
void seq_DrawPilotLightSeq(double xPos, double yPos, double nAngle);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue