# HG changeset patch # User Matti Hamalainen # Date 1411600058 -10800 # Node ID cfc74ec918dc3b329ded1d64f152c3695c44bda6 # Parent 36c43f085b28227a0225334eb59ac0a069d883ec Fix handling of "large" SID files. diff -r 36c43f085b28 -r cfc74ec918dc sidinfo.c --- a/sidinfo.c Thu Sep 25 02:07:21 2014 +0300 +++ b/sidinfo.c Thu Sep 25 02:07:38 2014 +0300 @@ -351,19 +351,21 @@ { read = fread(fileData, sizeof(uint8_t), PSID_BUFFER_SIZE, inFile); psid->dataSize += read; - if (read < 16) - { - THERR("Error reading song data, unexpectedly small file.\n"); - goto error; - } if (first && psid->loadAddress == 0) { + if (read < 4) + { + THERR("Error reading song data, unexpectedly small file.\n"); + goto error; + } + // Strip load address (2 first bytes) th_md5_append(&state, &fileData[2], read - 2); first = FALSE; } else + if (read > 0) { // Append "as is" th_md5_append(&state, fileData, read);