comparison 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
comparison
equal deleted inserted replaced
370:58c4018426da 371:22e8ee2df9ac
169 ret = th_io_error(ctx, THERR_NOT_SUPPORTED, 169 ret = th_io_error(ctx, THERR_NOT_SUPPORTED,
170 "Not a supported PSID or RSID file."); 170 "Not a supported PSID or RSID file.");
171 goto exit; 171 goto exit;
172 } 172 }
173 173
174 psid->isRSID = psid->magic[0] == 'R'; 174 if ((psid->isRSID = psid->magic[0] == 'R'))
175 {
176 if (psid->version < 2 ||
177 psid->loadAddress != 0 ||
178 psid->playAddress != 0 ||
179 psid->speed != 0)
180 {
181 psid->isInvalidRSID = TRUE;
182 }
183 }
175 184
176 if (!sidlib_fread_str(ctx, chconv, &psid->sidName, SIDLIB_PSID_STR_LEN) || 185 if (!sidlib_fread_str(ctx, chconv, &psid->sidName, SIDLIB_PSID_STR_LEN) ||
177 !sidlib_fread_str(ctx, chconv, &psid->sidAuthor, SIDLIB_PSID_STR_LEN) || 186 !sidlib_fread_str(ctx, chconv, &psid->sidAuthor, SIDLIB_PSID_STR_LEN) ||
178 !sidlib_fread_str(ctx, chconv, &psid->sidCopyright, SIDLIB_PSID_STR_LEN)) 187 !sidlib_fread_str(ctx, chconv, &psid->sidCopyright, SIDLIB_PSID_STR_LEN))
179 { 188 {