mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-25 18:42:08 -05:00
Fix some invalid memory reads
This commit is contained in:
parent
f2fa810755
commit
b0825b6971
3 changed files with 6 additions and 6 deletions
|
@ -32,7 +32,7 @@ void Launcher_ShowError(ReturnCode res, const char* place) {
|
|||
String msg; char msgBuffer[STRING_SIZE * 2];
|
||||
String_InitArray_NT(msg, msgBuffer);
|
||||
|
||||
String_Format2(&msg, "Error %x when %c", &res, place);
|
||||
String_Format2(&msg, "Error %h when %c", &res, place);
|
||||
msg.buffer[msg.length] = '\0';
|
||||
Window_ShowDialog("Error", msg.buffer);
|
||||
}
|
||||
|
|
|
@ -384,11 +384,11 @@ static ReturnCode ModernPatcher_PatchTile(struct Stream* data, struct TilePatch*
|
|||
ReturnCode res;
|
||||
|
||||
if ((res = Png_Decode(&bmp, data))) return res;
|
||||
Bitmap_CopyBlock(0, 0, tile->X1 * 16, tile->Y1 * 16, &terrainBmp, &bmp, 16);
|
||||
Bitmap_CopyBlock(0, 0, tile->X1 * 16, tile->Y1 * 16, &bmp, &terrainBmp, 16);
|
||||
|
||||
/* only quartz needs copying to two tiles */
|
||||
if (tile->Y2) {
|
||||
Bitmap_CopyBlock(0, 0, tile->X2 * 16, tile->Y2 * 16, &terrainBmp, &bmp, 16);
|
||||
Bitmap_CopyBlock(0, 0, tile->X2 * 16, tile->Y2 * 16, &bmp, &terrainBmp, 16);
|
||||
}
|
||||
|
||||
Mem_Free(bmp.Scan0);
|
||||
|
|
|
@ -819,15 +819,15 @@ void StringsBuffer_Remove(StringsBuffer* buffer, int index) {
|
|||
}
|
||||
|
||||
/* Adjust text offset of elements after this element */
|
||||
/* Elements may not be in order so most account for that */
|
||||
/* Elements may not be in order so must account for that */
|
||||
offsetAdj = len << STRINGSBUFFER_LEN_SHIFT;
|
||||
for (i = index; i < buffer->Count; i++) {
|
||||
for (i = index; i < buffer->Count - 1; i++) {
|
||||
buffer->FlagsBuffer[i] = buffer->FlagsBuffer[i + 1];
|
||||
if (buffer->FlagsBuffer[i] >= flags) {
|
||||
buffer->FlagsBuffer[i] -= offsetAdj;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buffer->Count--;
|
||||
buffer->TotalLength -= len;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue