diff sidlib.c @ 371:22e8ee2df9ac

Check for RSID validity, too.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 08 Oct 2021 14:04:00 +0300
parents f73270cabde2
children 911814a9d5ee
line wrap: on
line diff
--- a/sidlib.c	Tue Mar 23 17:05:24 2021 +0200
+++ b/sidlib.c	Fri Oct 08 14:04:00 2021 +0300
@@ -171,7 +171,16 @@
         goto exit;
     }
 
-    psid->isRSID = psid->magic[0] == 'R';
+    if ((psid->isRSID = psid->magic[0] == 'R'))
+    {
+        if (psid->version < 2 ||
+            psid->loadAddress != 0 ||
+            psid->playAddress != 0 ||
+            psid->speed != 0)
+        {
+            psid->isInvalidRSID = TRUE;
+        }
+    }
 
     if (!sidlib_fread_str(ctx, chconv, &psid->sidName, SIDLIB_PSID_STR_LEN) ||
         !sidlib_fread_str(ctx, chconv, &psid->sidAuthor, SIDLIB_PSID_STR_LEN) ||