Skip to content

Commit

Permalink
6.4.10-rc3 (#1387)
Browse files Browse the repository at this point in the history
- Fix accidental emoticon filtering
  • Loading branch information
tmolitor-stud-tu authored Jan 26, 2025
2 parents 9696aff + 57c4c0b commit c44acab
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions Monal/Classes/HelperTools.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ -(void) swizzled_queueLogMessage:(DDLogMessage*) logMessage asynchronously:(BOOL
static NSObject* _suspensionHandling_lock = nil;
static BOOL _suspensionHandling_isSuspended = NO;
static NSMutableDictionary* _versionInfoCache;
static NSCharacterSet* _validXMLCharacters;
static NSCharacterSet* _invalidXMLCharacters;
static MLStreamRedirect* _stdoutRedirector = nil;
static MLStreamRedirect* _stderrRedirector = nil;
static volatile void (*_oldExceptionHandler)(NSException*) = NULL;
Expand Down Expand Up @@ -396,7 +396,7 @@ +(void) initialize
[notRecommendedXMLCharacters appendFormat:@"%C", i];

[validXMLCharacters removeCharactersInString:notRecommendedXMLCharacters];
_validXMLCharacters = [validXMLCharacters copy];
_invalidXMLCharacters = [validXMLCharacters invertedSet];

//shamelessly stolen from utils.ip in conversations source
IPV4 = [NSRegularExpression regularExpressionWithPattern:@"\\A(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}\\z" options:0 error:nil];
Expand Down Expand Up @@ -2935,15 +2935,7 @@ +(NSArray*) splitString:(NSString*) string withSeparator:(NSString*) separator a

+(NSString*) removeInvalidXMLCharactersFromString:(NSString*) inputString
{
NSMutableString* result = [NSMutableString new];
for(NSUInteger i = 0; i < inputString.length; i++)
{
unichar character = [inputString characterAtIndex:i];
//allow everything above 0x10FFFF
if(character > 0x10FFFF || [_validXMLCharacters characterIsMember:character])
[result appendFormat:@"%C", character];
}
return [result copy];
return [[inputString componentsSeparatedByCharactersInSet:_invalidXMLCharacters] componentsJoinedByString:@""];
}

//see https://nachtimwald.com/2017/04/02/constant-time-string-comparison-in-c/
Expand Down

0 comments on commit c44acab

Please sign in to comment.