Skip to content

Commit

Permalink
Fix ASAN reports: runtime error: left shift of XXX by 24 places canno…
Browse files Browse the repository at this point in the history
…t be represented in type 'int'
  • Loading branch information
1bsyl authored and slouken committed Jan 11, 2024
1 parent d2e6ded commit ba51905
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/SDL_ttf.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ static SDL_INLINE void BG_Blended_Opaque_SDF(const TTF_Image *image, Uint32 *des
/* *INDENT-OFF* */
DUFFS_LOOP4(
d = *dst;
s = *src++ << 24;
s = ((Uint32)*src++) << 24;
if (s > d) {
*dst = s;
}
Expand Down Expand Up @@ -539,7 +539,7 @@ static SDL_INLINE void BG_Blended_Opaque(const TTF_Image *image, Uint32 *destina
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP4(
*dst++ |= *src++ << 24;
*dst++ |= ((Uint32)*src++) << 24;
, width);
/* *INDENT-ON* */
src += srcskip;
Expand Down Expand Up @@ -580,10 +580,10 @@ static SDL_INLINE void BG_Blended_Opaque_32(const TTF_Image *image, Uint32 *dest
while (height--) {
/* *INDENT-OFF* */
DUFFS_LOOP4(
*dst++ |= *src++ << 24;
*dst++ |= *src++ << 24;
*dst++ |= *src++ << 24;
*dst++ |= *src++ << 24;
*dst++ |= ((Uint32)*src++) << 24;
*dst++ |= ((Uint32)*src++) << 24;
*dst++ |= ((Uint32)*src++) << 24;
*dst++ |= ((Uint32)*src++) << 24;
, width);
/* *INDENT-ON* */
src += srcskip;
Expand Down Expand Up @@ -1551,7 +1551,7 @@ static SDL_Surface *Create_Surface_Blended(int width, int height, SDL_Color fg,
bgcolor = (fg.r << 16) | (fg.g << 8) | fg.b;

/* Underline/Strikethrough color style */
*color = bgcolor | (fg.a << 24);
*color = bgcolor | ((Uint32)fg.a << 24);

/* Create the target surface if required */
if (width != 0) {
Expand All @@ -1575,10 +1575,10 @@ static SDL_Surface* Create_Surface_LCD(int width, int height, SDL_Color fg, SDL_
Uint32 bgcolor;

/* Background color */
bgcolor = (bg.a << 24) | (bg.r << 16) | (bg.g << 8) | bg.b;
bgcolor = (((Uint32)bg.a) << 24) | (bg.r << 16) | (bg.g << 8) | bg.b;

/* Underline/Strikethrough color style */
*color = (bg.a << 24) | (fg.r << 16) | (fg.g << 8) | fg.b;
*color = (((Uint32)bg.a) << 24) | (fg.r << 16) | (fg.g << 8) | fg.b;

/* Create the target surface if required */
if (width != 0) {
Expand Down

3 comments on commit ba51905

@sezero
Copy link
Contributor

@sezero sezero commented on ba51905 Jan 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@madebr : is setup-sdl broken?

@madebr
Copy link
Contributor

@madebr madebr commented on ba51905 Jan 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it. I updated the dependencies today.
I reverted the change.

@madebr
Copy link
Contributor

@madebr madebr commented on ba51905 Jan 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the other hand, https://github.com/libsdl-org/SDL_ttf/actions/runs/7492007692 finished just fine.

Please sign in to comment.