Merge pull request #185 from triplef/fix-unicode-lookup

Fix lookup of string encodings with high numeric values in encoding table
This commit is contained in:
rfm 2021-06-18 10:01:36 +01:00 committed by GitHub
commit a1b0c1c8db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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];
}