From b654c2e170e0cdd8ea0a212f5ca7e9b1047aa553 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 18 Mar 2025 20:23:31 -0400 Subject: [PATCH] Avoid potential out-of-bounds access. --- Storage/MassStorage/SCSI/SCSI.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Storage/MassStorage/SCSI/SCSI.cpp b/Storage/MassStorage/SCSI/SCSI.cpp index d14bdec22..02d801e1d 100644 --- a/Storage/MassStorage/SCSI/SCSI.cpp +++ b/Storage/MassStorage/SCSI/SCSI.cpp @@ -99,7 +99,7 @@ void Bus::run_for(HalfCycles time) { const auto old_index = dispatch_index_; const auto time_as_int = time_in_state_.as_integral(); - while(time_as_int >= dispatch_times_[dispatch_index_] && dispatch_index_ < dispatch_times_.size()) { + while(dispatch_index_ < dispatch_times_.size() && time_as_int >= dispatch_times_[dispatch_index_]) { ++dispatch_index_; }