In
fa06dd40f48b20d738b6bd604758c81defd76cfd I misunderstood the
subdivision code, causing sentinel2 to be written past the end of the
buffer... somehow many maps and games worked fine despite this. This
commit reverts the bad line from that commit.
A very old (div0-stable) bug when loading Q1BSP meant we didn't allocate
enough texture memory when a "sky" texture name wasn't all lowercase,
causing a crash when loading custom map e2m9.
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
// pretty up the buffer (replacing any trailing garbage with 0)
for (j = (int)strlen(name); j < 16; j++)
name[j] = 0;
+ // bones_was_here: force all names to lowercase (matching code below) so we don't crash on e2m9
+ for (j = 0;name[j];j++)
+ if (name[j] >= 'A' && name[j] <= 'Z')
+ name[j] += 'a' - 'A';
if (!strncmp(name, "sky", 3))
numsky++;
//if (developer.integer > 0 && developer_memorydebug.integer)
// _Mem_CheckSentinelsGlobal(filename, fileline);
pool->totalsize += size;
- // calculate the smallest realsize that is a multiple of alignment
- realsize = (sizeof(memheader_t) + size + sizeof(sentinel2) + (alignment-1)) & ~(alignment-1);
+ realsize = alignment + sizeof(memheader_t) + size + sizeof(sentinel2);
pool->realsize += realsize;
base = (unsigned char *)Clump_AllocBlock(realsize);
if (base == NULL)