Skip to content

Commit 6ff3332

Browse files
committed
(Ozone) Fix longstanding issue
TODO/FIXME - undefined behavior reported by ASAN - *-35.2358 is outside the range of representable values of type 'unsigned int'
1 parent 19fb869 commit 6ff3332

1 file changed

Lines changed: 16 additions & 20 deletions

File tree

menu/drivers/ozone.c

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3109,7 +3109,7 @@ static int ozone_wiggle(ozone_handle_t* ozone, float t)
31093109
}
31103110

31113111
/* Changes x and y to the current offset of the cursor wiggle animation */
3112-
static void ozone_apply_cursor_wiggle_offset(ozone_handle_t *ozone, int *x, size_t *y)
3112+
static void ozone_apply_cursor_wiggle_offset(ozone_handle_t *ozone, int *x, int *y)
31133113
{
31143114
retro_time_t cur_time, t;
31153115

@@ -3156,15 +3156,15 @@ static void ozone_draw_cursor_slice(
31563156
int x_offset,
31573157
unsigned width,
31583158
unsigned height,
3159-
size_t y,
3159+
int y,
31603160
float alpha,
31613161
math_matrix_4x4 *mymat)
31623162
{
31633163
gfx_display_ctx_driver_t
31643164
*dispctx = p_disp->dispctx;
31653165
float scale_factor = ozone->last_scale_factor;
31663166
int slice_x = x_offset - (12 + 1) * scale_factor;
3167-
int slice_y = (int)y + 8 * scale_factor;
3167+
int slice_y = y + 8 * scale_factor;
31683168
unsigned slice_new_w = width + (24 + 1) * scale_factor;
31693169
unsigned slice_new_h = height + 20 * scale_factor;
31703170
unsigned slice_w = 80;
@@ -3232,7 +3232,7 @@ static void ozone_draw_cursor_fallback(
32323232
int x_offset,
32333233
unsigned width,
32343234
unsigned height,
3235-
size_t y,
3235+
int y,
32363236
float alpha)
32373237
{
32383238
gfx_display_set_alpha(ozone->theme_dynamic.selection_border, alpha);
@@ -3245,7 +3245,7 @@ static void ozone_draw_cursor_fallback(
32453245
video_width,
32463246
video_height,
32473247
x_offset - ozone->dimensions.spacer_3px,
3248-
(int)y,
3248+
y,
32493249
width + ozone->dimensions.spacer_3px * 2,
32503250
height,
32513251
video_width,
@@ -3262,7 +3262,7 @@ static void ozone_draw_cursor_fallback(
32623262
video_width,
32633263
video_height,
32643264
x_offset - ozone->dimensions.spacer_5px,
3265-
(int)(y - ozone->dimensions.spacer_3px),
3265+
y - ozone->dimensions.spacer_3px,
32663266
width + 1 + ozone->dimensions.spacer_5px * 2,
32673267
ozone->dimensions.spacer_3px,
32683268
video_width,
@@ -3277,7 +3277,7 @@ static void ozone_draw_cursor_fallback(
32773277
video_width,
32783278
video_height,
32793279
x_offset - ozone->dimensions.spacer_5px,
3280-
(int)(y + height),
3280+
y + (int)height,
32813281
width + 1 + ozone->dimensions.spacer_5px * 2,
32823282
ozone->dimensions.spacer_3px,
32833283
video_width,
@@ -3292,7 +3292,7 @@ static void ozone_draw_cursor_fallback(
32923292
video_width,
32933293
video_height,
32943294
x_offset - ozone->dimensions.spacer_5px,
3295-
(int)y,
3295+
y,
32963296
ozone->dimensions.spacer_3px,
32973297
height,
32983298
video_width,
@@ -3307,7 +3307,7 @@ static void ozone_draw_cursor_fallback(
33073307
video_width,
33083308
video_height,
33093309
x_offset + width + ozone->dimensions.spacer_3px,
3310-
(int)y,
3310+
y,
33113311
ozone->dimensions.spacer_3px,
33123312
height,
33133313
video_width,
@@ -3325,12 +3325,12 @@ static void ozone_draw_cursor(
33253325
int x_offset,
33263326
unsigned width,
33273327
unsigned height,
3328-
size_t y,
3328+
int y,
33293329
float alpha,
33303330
math_matrix_4x4 *mymat)
33313331
{
3332-
int new_x = x_offset;
3333-
size_t new_y = y;
3332+
int new_x = x_offset;
3333+
int new_y = y;
33343334

33353335
/* Apply wiggle animation if needed */
33363336
if (ozone->flags2 & OZONE_FLAG2_CURSOR_WIGGLING)
@@ -3578,7 +3578,7 @@ static void ozone_draw_sidebar(
35783578
ozone->sidebar_offset + ozone->dimensions.sidebar_padding_horizontal + ozone->dimensions.spacer_3px,
35793579
entry_width - ozone->dimensions.spacer_5px,
35803580
ozone->dimensions.sidebar_entry_height + ozone->dimensions.spacer_1px,
3581-
selection_y + ozone->animations.scroll_y_sidebar,
3581+
(int)((float)selection_y + ozone->animations.scroll_y_sidebar),
35823582
ozone->animations.cursor_alpha,
35833583
mymat);
35843584

@@ -3592,7 +3592,7 @@ static void ozone_draw_sidebar(
35923592
ozone->sidebar_offset + ozone->dimensions.sidebar_padding_horizontal + ozone->dimensions.spacer_3px,
35933593
entry_width - ozone->dimensions.spacer_5px,
35943594
ozone->dimensions.sidebar_entry_height + ozone->dimensions.spacer_1px,
3595-
selection_old_y + ozone->animations.scroll_y_sidebar,
3595+
(int)((float)selection_old_y + ozone->animations.scroll_y_sidebar),
35963596
1 - ozone->animations.cursor_alpha,
35973597
mymat);
35983598

@@ -5949,7 +5949,7 @@ static void ozone_draw_entries(
59495949
ozone->dimensions_sidebar_width + x_offset + entry_padding + ozone->dimensions.spacer_3px,
59505950
entry_width - ozone->dimensions.spacer_5px,
59515951
button_height + ozone->dimensions.spacer_1px,
5952-
selection_y + scroll_y,
5952+
(int)((float)selection_y + scroll_y),
59535953
ozone->animations.cursor_alpha * alpha,
59545954
mymat);
59555955

@@ -5962,13 +5962,9 @@ static void ozone_draw_entries(
59625962
video_width,
59635963
video_height,
59645964
(unsigned)ozone->dimensions_sidebar_width + x_offset + entry_padding + ozone->dimensions.spacer_3px,
5965-
/* TODO/FIXME - undefined behavior reported by ASAN -
5966-
*-35.2358 is outside the range of representable values
5967-
of type 'unsigned int'
5968-
* */
59695965
entry_width - ozone->dimensions.spacer_5px,
59705966
button_height + ozone->dimensions.spacer_1px,
5971-
old_selection_y + scroll_y,
5967+
(int)((float)old_selection_y + scroll_y),
59725968
(1 - ozone->animations.cursor_alpha) * alpha,
59735969
mymat);
59745970

0 commit comments

Comments
 (0)