[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:52:01 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit f49187d378a03c8ef2078601a0b1164fcd6a7602
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Aug 18 06:02:22 2003 +0000

            Reviewed by Maciej.
    
            - fixed 3376522 -- REGRESSION: uncaught exception from bad .ico causes crash (login window at 34sp.com)
    
            I added exception handling in all the places we load images with NSImage.
    
            * Misc.subproj/WebIconDatabase.m:
            (-[WebIconDatabase _iconsForIconURLString:]): Add exception handler.
            * Misc.subproj/WebIconLoader.m:
            (-[WebIconLoader connectionDidFinishLoading:]): Add exception handler.
            * WebCoreSupport.subproj/WebImageRenderer.m:
            (-[WebImageRenderer initWithData:MIMEType:]): Add exception handler.
            (-[WebImageRenderer initWithContentsOfFile:]): Add exception handler.
            (-[WebImageRenderer incrementalLoadWithBytes:length:complete:]): Add exception handler.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4834 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 35c1faf..2a70797 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,20 @@
+2003-08-17  Darin Adler  <darin at apple.com>
+
+        Reviewed by Maciej.
+
+        - fixed 3376522 -- REGRESSION: uncaught exception from bad .ico causes crash (login window at 34sp.com)
+
+        I added exception handling in all the places we load images with NSImage.
+
+        * Misc.subproj/WebIconDatabase.m:
+        (-[WebIconDatabase _iconsForIconURLString:]): Add exception handler.
+        * Misc.subproj/WebIconLoader.m:
+        (-[WebIconLoader connectionDidFinishLoading:]): Add exception handler.
+        * WebCoreSupport.subproj/WebImageRenderer.m:
+        (-[WebImageRenderer initWithData:MIMEType:]): Add exception handler.
+        (-[WebImageRenderer initWithContentsOfFile:]): Add exception handler.
+        (-[WebImageRenderer incrementalLoadWithBytes:length:complete:]): Add exception handler.
+
 2003-08-15  Richard Williamson  <rjw at apple.com>
 
 	Fixed 3378530.  Ensure that line is always drawn within bounds
diff --git a/WebKit/Misc.subproj/WebIconDatabase.m b/WebKit/Misc.subproj/WebIconDatabase.m
index c5a89fd..b709b59 100644
--- a/WebKit/Misc.subproj/WebIconDatabase.m
+++ b/WebKit/Misc.subproj/WebIconDatabase.m
@@ -405,16 +405,19 @@ NSSize WebIconLargeSize = {128, 128};
     }
     
     if (iconData) {
-	NSImage *icon = [[NSImage alloc] initWithData:iconData];
-	icons = [self _iconsBySplittingRepresentationsOfIcon:icon];
-	
-	if(icons){
+        NS_DURING
+            NSImage *icon = [[NSImage alloc] initWithData:iconData];
+            icons = [self _iconsBySplittingRepresentationsOfIcon:icon];
+            if (icons) {
 #if !LOG_DISABLED 
-	    double duration = CFAbsoluteTimeGetCurrent() - start;
-	    LOG(Timing, "loading and creating icon %@ took %f seconds", iconURLString, duration);
+                double duration = CFAbsoluteTimeGetCurrent() - start;
+                LOG(Timing, "loading and creating icon %@ took %f seconds", iconURLString, duration);
 #endif
-	    [_private->iconURLToIcons setObject:icons forKey:iconURLString];
-	}
+                [_private->iconURLToIcons setObject:icons forKey:iconURLString];
+            }
+        NS_HANDLER
+            icons = nil;
+        NS_ENDHANDLER
     }
     
     return icons;
diff --git a/WebKit/Misc.subproj/WebIconLoader.m b/WebKit/Misc.subproj/WebIconLoader.m
index 65cd54a..8dad29a 100644
--- a/WebKit/Misc.subproj/WebIconLoader.m
+++ b/WebKit/Misc.subproj/WebIconLoader.m
@@ -97,7 +97,12 @@
 
 - (void)connectionDidFinishLoading:(NSURLConnection *)connection
 {
-    NSImage *icon = [[NSImage alloc] initWithData:_private->resourceData];
+    NSImage *icon;
+    NS_DURING
+        icon = [[NSImage alloc] initWithData:_private->resourceData];
+    NS_HANDLER
+        icon = nil;
+    NS_ENDHANDLER
     if (icon && [[icon representations] count]) {
         [[WebIconDatabase sharedIconDatabase] _setIcon:icon forIconURL:[[self URL] _web_originalDataAsString]];
     } else {
diff --git a/WebKit/WebCoreSupport.subproj/WebImageRenderer.m b/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
index 89bddcb..1738f5b 100644
--- a/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebImageRenderer.m
@@ -56,7 +56,11 @@ static NSMutableSet *activeImageRenderers;
 
 - (id)initWithData:(NSData *)data MIMEType:(NSString *)MIME
 {
-    self = [super initWithData:data];
+    NS_DURING
+        self = [super initWithData:data];
+    NS_HANDLER
+        self = nil;
+    NS_ENDHANDLER
     if (self != nil) {
         // Work around issue with flipped images and TIFF by never using the image cache.
         // See bug 3344259 and related bugs.
@@ -73,7 +77,11 @@ static NSMutableSet *activeImageRenderers;
 {
     NSBundle *bundle = [NSBundle bundleForClass:[self class]];
     NSString *imagePath = [bundle pathForResource:filename ofType:@"tiff"];
-    self = [super initWithContentsOfFile:imagePath];
+    NS_DURING
+        self = [super initWithContentsOfFile:imagePath];
+    NS_HANDLER
+        self = nil;
+    NS_ENDHANDLER
     if (self != nil) {
         // Work around issue with flipped images and TIFF by never using the image cache.
         // See bug 3344259 and related bugs.
@@ -134,7 +142,11 @@ static NSMutableSet *activeImageRenderers;
     NSBitmapImageRep *imageRep = [[self representations] objectAtIndex:0];
     NSData *data = [[NSData alloc] initWithBytes:bytes length:length];
 
-    loadStatus = [imageRep incrementalLoadFromData:data complete:isComplete];
+    NS_DURING
+        loadStatus = [imageRep incrementalLoadFromData:data complete:isComplete];
+    NS_HANDLER
+        loadStatus = NSImageRepLoadStatusInvalidData; // Arbitrary choice; any error will do.
+    NS_ENDHANDLER
 
     // Hold onto the original data in case we need to copy this image.  (Workaround for appkit NSImage
     // copy flaw).

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list