Changeset - r26726:f9b8a507e8ed
[Not reviewed]
master
0 3 0
Rubidium - 23 months ago 2023-01-03 18:11:24
rubidium@openttd.org
Codechange: prevent suspicious pointer scaling
3 files changed with 6 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/3rdparty/squirrel/squirrel/sqstate.cpp
Show inline comments
 
@@ -513,7 +513,7 @@ void RefTable::AllocNodes(SQUnsignedInte
 
		bucks[n] = nullptr;
 
		temp->refs = 0;
 
		new (&temp->obj) SQObjectPtr;
 
		temp->next = temp+1;
 
		temp->next = &temp[1];
 
		temp++;
 
	}
 
	bucks[n] = nullptr;
src/blitter/32bpp_anim.cpp
Show inline comments
 
@@ -383,7 +383,7 @@ void Blitter_32bppAnim::CopyFromBuffer(v
 
		dst += _screen.pitch;
 
		/* Copy back the anim-buffer */
 
		memcpy(anim_line, usrc, width * sizeof(uint16));
 
		usrc = (const uint32 *)((const uint16 *)usrc + width);
 
		usrc = (const uint32 *)&((const uint16 *)usrc)[width];
 
		anim_line += this->anim_buf_pitch;
 

	
 
		/* Okay, it is *very* likely that the image we stored is using
 
@@ -422,7 +422,7 @@ void Blitter_32bppAnim::CopyToBuffer(con
 
		udst += width;
 
		/* Copy the anim-buffer */
 
		memcpy(udst, anim_line, width * sizeof(uint16));
 
		udst = (uint32 *)((uint16 *)udst + width);
 
		udst = (uint32 *)&((uint16 *)udst)[width];
 
		anim_line += this->anim_buf_pitch;
 
	}
 
}
src/blitter/32bpp_optimized.cpp
Show inline comments
 
@@ -316,8 +316,9 @@ template <bool Tpal_to_rgb> Sprite *Blit
 
		const SpriteLoader::CommonPixel *src = (const SpriteLoader::CommonPixel *)src_orig->data;
 

	
 
		for (uint y = src_orig->height; y > 0; y--) {
 
			Colour *dst_px = (Colour *)(dst_px_ln + 1);
 
			uint16 *dst_n = (uint16 *)(dst_n_ln + 1);
 
			/* Index 0 of dst_px and dst_n is left as space to save the length of the row to be filled later. */
 
			Colour *dst_px = (Colour *)&dst_px_ln[1];
 
			uint16 *dst_n = (uint16 *)&dst_n_ln[1];
 

	
 
			uint16 *dst_len = dst_n++;
 

	
0 comments (0 inline, 0 general)