File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -215,9 +215,6 @@ bool cGraphics_Amiga::Sprite_OnScreen_Check(bool p16bit) {
215215 }
216216
217217 mFodder ->mVideo_Draw_FrameDataPtr += ax;
218-
219- if (mFodder ->mVideo_Draw_PosX < 0 )
220- return false ;
221218 }
222219
223220 ax = mFodder ->mVideo_Draw_PosX + drawColumns;
@@ -608,8 +605,11 @@ sImage cGraphics_Amiga::DecodeIFF(const std::string& pFilename) {
608605 break ;
609606 }
610607
611- case ' CMAP' :
612- for (uint16 i = 0 ; i < Size / 3 ; ++i) {
608+ case ' CMAP' : {
609+ size_t Colors = Size / 3 ;
610+ size_t ColorsToRead = std::min (Colors, std::size (Result.mPalette ));
611+
612+ for (size_t i = 0 ; i < ColorsToRead && FileSize >= 3 ; ++i) {
613613 int16 d0 = (int16)*DataPtr++;
614614 int16 Final = 0 ;
615615
@@ -636,9 +636,14 @@ sImage cGraphics_Amiga::DecodeIFF(const std::string& pFilename) {
636636 }
637637
638638 FileSize -= 3 ;
639-
640639 }
640+
641+ size_t BytesRead = ColorsToRead * 3 ;
642+ size_t BytesRemaining = Size > BytesRead ? Size - BytesRead : 0 ;
643+ DataPtr += BytesRemaining;
644+ FileSize -= std::min (FileSize, BytesRemaining);
641645 break ;
646+ }
642647
643648 default :
644649 if (Size & 1 )
You can’t perform that action at this time.
0 commit comments