[Scummvm-git-logs] scummvm master -> aa7e21d6c05ef71cef37741f94378bdfacdbad74

Strangerke noreply at scummvm.org
Wed Mar 9 20:38:50 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
aa7e21d6c0 CHEWY: Fix coverity 1475951, 1475954 and 1475956 (out of bounds reads)


Commit: aa7e21d6c05ef71cef37741f94378bdfacdbad74
    https://github.com/scummvm/scummvm/commit/aa7e21d6c05ef71cef37741f94378bdfacdbad74
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2022-03-09T21:38:41+01:00

Commit Message:
CHEWY: Fix coverity 1475951, 1475954 and 1475956 (out of bounds reads)

Changed paths:
    engines/chewy/detail.cpp


diff --git a/engines/chewy/detail.cpp b/engines/chewy/detail.cpp
index cb12f2afee0..50d55c42001 100644
--- a/engines/chewy/detail.cpp
+++ b/engines/chewy/detail.cpp
@@ -399,10 +399,10 @@ void Detail::plot_ani_details(int16 scrx, int16 scry, int16 start, int16 end, in
 	if (start > end)
 		SWAP(start, end);
 
-	if (start > MAXDETAILS)
+	if (start >= MAXDETAILS)
 		start = 0;
 
-	if (end > MAXDETAILS)
+	if (end >= MAXDETAILS)
 		end = MAXDETAILS - 1;
 
 	for (int16 i = start; (i <= end); i++) {
@@ -485,10 +485,10 @@ void Detail::plot_static_details(int16 scrx, int16 scry, int16 start, int16 end)
 	if (start > end)
 		SWAP(start, end);
 
-	if (start > MAXDETAILS)
+	if (start >= MAXDETAILS)
 		start = 0;
 	
-	if (end > MAXDETAILS)
+	if (end >= MAXDETAILS)
 		end = MAXDETAILS - 1;
 
 	for (int16 i = start; i <= end; i++) {
@@ -563,7 +563,7 @@ int16 Detail::get_ani_status(int16 det_nr) {
 }
 
 SprInfo Detail::plot_detail_sprite(int16 scrx, int16 scry, int16 det_nr, int16 spr_nr, int16 mode) {
-	if (det_nr > MAXDETAILS)
+	if (det_nr >= MAXDETAILS)
 		det_nr = MAXDETAILS - 1;
 	AniDetailInfo *adiptr = &_rdi.Ainfo[det_nr];
 	if (spr_nr < adiptr->start_ani)




More information about the Scummvm-git-logs mailing list