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

From ec816e217548f52984fb06480bb3216f82e14a0b 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)
---
 showrtf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/showrtf.c b/showrtf.c
index 5949a24..a28c8f3 100644
--- a/showrtf.c
+++ b/showrtf.c
@@ -67,7 +67,7 @@ static Uint16 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);