diff --git a/lib/fluxsink/scpfluxsink.cc b/lib/fluxsink/scpfluxsink.cc index 697dcf0e..42e77c88 100644 --- a/lib/fluxsink/scpfluxsink.cc +++ b/lib/fluxsink/scpfluxsink.cc @@ -85,6 +85,12 @@ public: trackdataWriter.seekToEnd(); int strack = strackno(cylinder, head); + if (strack >= std::size(_fileheader.track)) { + std::cout << fmt::format("SCP: cannot write track {} head {}, " + "there are not not enough Track Data Headers.\n", + cylinder, head); + return; + } ScpTrack trackheader = {0}; trackheader.header.track_id[0] = 'T'; trackheader.header.track_id[1] = 'R';