Fix lookup of string encodings with high numeric values in encoding table

This commit is contained in:
Frederik Seiffert 2021-06-17 17:53:22 +02:00
parent 7ea49c252b
commit 8137b5a2a0
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,11 @@
2021-06-17 Frederik Seiffert <frederik@algoriddim.com>
* Source/Additions/Unicode.m:
Fix lookup of string encodings with high numeric values in
encoding table when they are interpreted as negative numbers
for some platforms/compilers (pertains
NSUTF16*EndianStringEncoding and NSUTF32*StringEncoding).
2021-06-03 Richard Frith-Macdonald <rfm@gnu.org>
* Headers/GNUstepBase/GSTLS.h: New session ivar for I/O handle.

View file

@ -364,10 +364,10 @@ EntryForEncoding(NSStringEncoding enc)
{
struct _strenc_ *entry = 0;
if (enc > 0)
if (enc != 0)
{
GSSetupEncodingTable();
if (enc <= encTableSize)
if (enc > 0 && enc <= encTableSize)
{
entry = encodingTable[enc];
}