Bug 51144

Summary: Clang -Wcast-align gives an error in WebBasePluginPackage.mm
Product: WebKit Reporter: Cameron Zwarich (cpst) <zwarich>
Component: Plug-insAssignee: Cameron Zwarich (cpst) <zwarich>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, eric, webkit.review.bot, zimmermann
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
Proposed patch darin: review+, zwarich: commit-queue-

Cameron Zwarich (cpst)
Reported 2010-12-15 15:25:05 PST
Clang -Wcast-align gives an error in WebBasePluginPackage.mm. This is the only error, so we might as well fix it.
Attachments
Proposed patch (4.47 KB, patch)
2010-12-15 17:34 PST, Cameron Zwarich (cpst)
darin: review+
zwarich: commit-queue-
Cameron Zwarich (cpst)
Comment 1 2010-12-15 17:34:56 PST
Created attachment 76716 [details] Proposed patch
Cameron Zwarich (cpst)
Comment 2 2010-12-15 20:35:27 PST
Fixed in r74172.
WebKit Review Bot
Comment 3 2010-12-16 15:37:59 PST
http://trac.webkit.org/changeset/74172 might have broken Leopard Intel Debug (Tests)
Nikolas Zimmermann
Comment 4 2010-12-21 05:53:04 PST
Since this patch is in, I can't use DRT on Leopard anymore: Exception Codes: KERN_INVALID_ADDRESS at 0x00000000bbadbeef Crashed Thread: 0 Thread 0 Crashed: 0 com.apple.WebKit 0x00d50a34 WTF::VectorBufferBase<unsigned int>::allocateBuffer(unsigned long) + 38 (Vector.h:286) 1 com.apple.WebKit 0x00d50a9b WTF::VectorBuffer<unsigned int, 128ul>::VectorBuffer(unsigned long) + 67 2 com.apple.WebKit 0x00d50acd WTF::Vector<unsigned int, 128ul>::Vector(unsigned long) + 47 3 com.apple.WebKit 0x00d4ecc5 -[WebBasePluginPackage isNativeLibraryData:] + 69 (WebBasePluginPackage.mm:356) 4 com.apple.WebKit 0x00df1e18 -[WebPluginPackage initWithPath:] + 550 (WebPluginPackage.mm:67) 5 com.apple.WebKit 0x00d4e9b0 +[WebBasePluginPackage pluginWithPath:] + 72 (WebBasePluginPackage.mm:79) 6 com.apple.WebKit 0x00defcf4 -[WebPluginDatabase(Internal) _scanForNewPlugins] + 442 (WebPluginDatabase.mm:488) 7 com.apple.WebKit 0x00df0980 -[WebPluginDatabase refresh] + 192 (WebPluginDatabase.mm:272) 8 com.apple.WebKit 0x00df1121 +[WebPluginDatabase sharedDatabase] + 189 (WebPluginDatabase.mm:72) 9 DumpRenderTree 0x00012f28 __ZL32addTestPluginsToPluginSearchPathPKc + 146 10 DumpRenderTree 0x0001651f dumpRenderTree(int, char const**) + 43 11 DumpRenderTree 0x00016874 main + 94 (DumpRenderTree.mm:711) 12 DumpRenderTree 0x00002b6a start + 54
Nikolas Zimmermann
Comment 5 2010-12-21 05:53:21 PST
(In reply to comment #4) > Since this patch is in, I can't use DRT on Leopard anymore: To clarify, it crashes on every test.
Nikolas Zimmermann
Comment 6 2010-12-21 06:09:18 PST
Comment on attachment 76716 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=76716&action=review > WebKit/mac/Plugins/WebBasePluginPackage.mm:355 > + NSUInteger sizeInBytes = [data length]; > + Vector<uint32_t, 128> rawData((sizeInBytes - 1) / 4 + 1); This silently assumes sizeInBytes > 0. The crash I see happens with sizeInBytes=0. So using sizeInBytes > 0 ? ((sizeInBytes - 1) / 4 + 1) : 0, should fix the problem.
Cameron Zwarich (cpst)
Comment 7 2010-12-21 10:51:32 PST
(In reply to comment #6) > (From update of attachment 76716 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=76716&action=review > > > WebKit/mac/Plugins/WebBasePluginPackage.mm:355 > > + NSUInteger sizeInBytes = [data length]; > > + Vector<uint32_t, 128> rawData((sizeInBytes - 1) / 4 + 1); > > This silently assumes sizeInBytes > 0. The crash I see happens with sizeInBytes=0. > So using sizeInBytes > 0 ? ((sizeInBytes - 1) / 4 + 1) : 0, should fix the problem. r=me on that, I was going to land this fix myself
Note You need to log in before you can comment on or make changes to this bug.