Revision: 15801
http://sourceforge.net/p/skim-app/code/15801
Author: hofman
Date: 2025-11-13 15:31:03 +0000 (Thu, 13 Nov 2025)
Log Message:
-----------
do check returned class from unarchiver, as we cannot rely on NSKeyedUnarchiver
to actually enforce the requested type, contrary to the documentation
Modified Paths:
--------------
trunk/NSUserDefaults_SKExtensions.m
trunk/NSValueTransformer_SKExtensions.m
trunk/SKFontWell.m
Modified: trunk/NSUserDefaults_SKExtensions.m
===================================================================
--- trunk/NSUserDefaults_SKExtensions.m 2025-11-13 14:57:50 UTC (rev 15800)
+++ trunk/NSUserDefaults_SKExtensions.m 2025-11-13 15:31:03 UTC (rev 15801)
@@ -50,14 +50,12 @@
if (color == nil) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- @try {
- color = [NSUnarchiver unarchiveObjectWithData:data];
- if ([color isKindOfClass:[NSColor class]] == NO)
- color = nil;
- }
+ @try { color = [NSUnarchiver unarchiveObjectWithData:data]; }
#pragma clang diagnostic pop
@catch (id e) {}
}
+ if ([color isKindOfClass:[NSColor class]] == NO)
+ color = nil;
} else {
NSArray *array = [self arrayForKey:key];
if ([array count]) {
Modified: trunk/NSValueTransformer_SKExtensions.m
===================================================================
--- trunk/NSValueTransformer_SKExtensions.m 2025-11-13 14:57:50 UTC (rev
15800)
+++ trunk/NSValueTransformer_SKExtensions.m 2025-11-13 15:31:03 UTC (rev
15801)
@@ -126,14 +126,12 @@
if (color == nil) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- @try {
- color = [NSUnarchiver unarchiveObjectWithData:value];
- if ([color isKindOfClass:[NSColor class]] == NO)
- return nil;
- }
+ @try { color = [NSUnarchiver unarchiveObjectWithData:value]; }
#pragma clang diagnostic pop
@catch (id e) {}
}
+ if ([color isKindOfClass:[NSColor class]] == NO)
+ return nil;
return color;
}
Modified: trunk/SKFontWell.m
===================================================================
--- trunk/SKFontWell.m 2025-11-13 14:57:50 UTC (rev 15800)
+++ trunk/SKFontWell.m 2025-11-13 15:31:03 UTC (rev 15801)
@@ -336,7 +336,7 @@
if ([type isEqualToString:SKNSFontPanelDescriptorsPboardType]) {
NSData *data = [pboard dataForType:type];
NSDictionary *dict = [data isKindOfClass:[NSData class]] ?
[NSKeyedUnarchiver unarchivedObjectOfClass:[NSDictionary class] fromData:data
error:NULL] : nil;
- if (dict) {
+ if ([dict isKindOfClass:[NSDictionary class]]) {
NSArray *fontDescriptors = [dict
objectForKey:SKNSFontCollectionFontDescriptors];
NSFontDescriptor *fontDescriptor = ([fontDescriptors
isKindOfClass:[NSArray class]] && [fontDescriptors count]) ? [fontDescriptors
objectAtIndex:0] : nil;
if ([fontDescriptor isKindOfClass:[NSFontDescriptor class]]) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit