Description: better ways to skip in a MidiFile
 The MSC codepath had CVE-2023-26923 (the read(tmp, len); in the
 loop should have been read(tmp, tmp_size); instead), plus both
 are inefficient. Upstream changed this to the Qt 5.10+ code in
 Mu͒seScore Studio 4, but we need to support older versions as well,
 so retain the VLA codepath for those (no change) and switch to
 the more efficient code for recent versions.
 Bonus, switch the other place upstream forgot (or doesn’t exist
 in mu͒4 any more) as well.
Author: mirabilos <tg@debian.org>
Bug: https://github.com/musescore/MuseScore/issues/16346
Forwarded: not-needed

--- a/midi/midifile.cpp
+++ b/midi/midifile.cpp
@@ -431,22 +431,13 @@ void MidiFile::writeLong(int i)
 
 void MidiFile::skip(qint64 len)
       {
-      // Note: if MS is updated to use Qt 5.10, this can be implemented with QIODevice::skip(), which should be more efficient
-      //       as bytes do not need to be moved around.
       if (len <= 0)
             return;
-#if (!defined (_MSCVER) && !defined (_MSC_VER))
+#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
       char tmp[len];
       read(tmp, len);
 #else
-      const int tmp_size = 256;  // Size of fixed-length temporary buffer. MSVC does not support VLA.
-      char tmp[tmp_size];
-      while(len > tmp_size) {
-            read(tmp, len);
-            len -= tmp_size;
-            }
-      // Now len is <= tmp_size, last read fits in the buffer.
-      read(tmp, tmp_size);
+      fp->skip(len);
 #endif
       }
 
--- a/miditools/midifile.cpp
+++ b/miditools/midifile.cpp
@@ -169,8 +169,12 @@ void MidiFile::skip(qint64 len)
       {
       if (len <= 0)
             return;
+#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
       char tmp[len];
       read(tmp, len);
+#else
+      fp->skip(len);
+#endif
       }
 
 /*---------------------------------------------------------
