SDL_rtf: Fix overflow in conversion from ‘int’ to ‘Uint16’ (f4dcc)

From f4dcc447253e37732255000b6bcab79bfa41701c Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Mon, 15 Jan 2024 20:38:24 +0100
Subject: [PATCH] =?UTF-8?q?Fix=20overflow=20in=20conversion=20from=20?=
 =?UTF-8?q?=E2=80=98int=E2=80=99=20to=20=E2=80=98Uint16=E2=80=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

(cherry picked from commit 0c2462a6cf64015e2e3c963f04eed2209ab3a2df)
---
 examples/showrtf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/showrtf.c b/examples/showrtf.c
index 1dbaf58..6e08f15 100644
--- a/examples/showrtf.c
+++ b/examples/showrtf.c
@@ -62,7 +62,7 @@ static Uint32 UTF8_to_UNICODE(const char *utf8, int *advance)
 
     ch = ((const unsigned char *)utf8)[i];
     if ( ch >= 0xF0 ) {
-        ch  =  (Uint16)(utf8[i]&0x07) << 18;
+        ch  =  (Uint16)((utf8[i]&0x07) << 18);
         ch |=  (Uint16)(utf8[++i]&0x3F) << 12;
         ch |=  (Uint16)(utf8[++i]&0x3F) << 6;
         ch |=  (Uint16)(utf8[++i]&0x3F);