Bug 132678

Summary: Blob.cpp fails to build with some gcc versions because of signed/unsigned comparison
Product: WebKit Reporter: Praveen Jadhav <praveen.j>
Component: WebKit EFLAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, commit-queue, lucas.de.marchi, oliver, tanay.c
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
ap: review-, ap: commit-queue-
Patch none

Praveen Jadhav
Reported 2014-05-08 02:30:04 PDT
WebKit build fails for EFL port with below error /home/praveen.j/WebKit/Source/WebCore/fileapi/Blob.cpp: In member function ‘long long unsigned int WebCore::Blob::size() const’: /home/praveen.j/WebKit/Source/WebCore/fileapi/Blob.cpp:127:69: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] cc1plus: all warnings being treated as errors make[2]: *** [Source/WebCore/CMakeFiles/WebCore.dir/fileapi/Blob.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [Source/WebCore/CMakeFiles/WebCore.dir/all] Error 2 make: *** [all] Error 2
Attachments
Patch (1.54 KB, patch)
2014-05-08 02:38 PDT, Praveen Jadhav
ap: review-
ap: commit-queue-
Patch (1.47 KB, patch)
2014-05-15 23:39 PDT, Tanay
no flags
Praveen Jadhav
Comment 1 2014-05-08 02:38:16 PDT
Alexey Proskuryakov
Comment 2 2014-05-08 09:30:20 PDT
Comment on attachment 231056 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=231056&action=review Sorry for the breakage - efl-wk2 bot was green, and efl one does not work. > Source/WebCore/fileapi/Blob.cpp:127 > - m_size = (actualSize <= std::numeric_limits<long long>::max()) ? static_cast<long long>(actualSize) : 0; > + m_size = (actualSize <= std::numeric_limits<unsigned long long>::max()) ? static_cast<long long>(actualSize) : 0; The purpose of this check is to verify that the number fits into long long - we already know that it fits into an unsigned long long! if it complains about signed/unsigned comparison, you probably need something like actualSize <= static_cast<unsigned long long>(std::numeric_limits<long long>::max()))
Praveen Jadhav
Comment 3 2014-05-09 03:52:44 PDT
Well, its strange that no one else got this error(efl buildbot is successful). I am not sure if this is because of some mismatch in my PC. Will try to resolve this locally. Thanks!
Alexey Proskuryakov
Comment 4 2014-05-15 09:31:19 PDT
*** Bug 132947 has been marked as a duplicate of this bug. ***
Alexey Proskuryakov
Comment 5 2014-05-15 09:33:19 PDT
As mentioned in duplicate, perhaps we have an existing less wordy solution for this? Perhaps something in CheckedArithmetic.h?
Alexey Proskuryakov
Comment 6 2014-05-15 09:51:20 PDT
Seems like isInBounds<long long>(actualSize) should do the trick.
Tanay
Comment 7 2014-05-15 23:39:07 PDT
Tanay
Comment 8 2014-05-15 23:41:10 PDT
(In reply to comment #6) > Seems like isInBounds<long long>(actualSize) should do the trick. Yes it fixes the build issue. Uploaded a patch with changes.
Alexey Proskuryakov
Comment 9 2014-05-16 09:33:06 PDT
Comment on attachment 231560 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=231560&action=review > Source/WebCore/fileapi/Blob.cpp:127 > + m_size = (WTF::isInBounds<long long>(actualSize)) ? static_cast<long long>(actualSize) : 0; Does it compile without "WTF::"? Please remove the prefix when landing if it does.
Tanay
Comment 10 2014-05-18 19:51:29 PDT
(In reply to comment #9) > (From update of attachment 231560 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=231560&action=review > > > Source/WebCore/fileapi/Blob.cpp:127 > > + m_size = (WTF::isInBounds<long long>(actualSize)) ? static_cast<long long>(actualSize) : 0; > > Does it compile without "WTF::"? Please remove the prefix when landing if it does. Without 'WTF::' compiler is not able to resolve the function. We should retain it.
WebKit Commit Bot
Comment 11 2014-05-26 00:15:40 PDT
Comment on attachment 231560 [details] Patch Clearing flags on attachment: 231560 Committed r169329: <http://trac.webkit.org/changeset/169329>
WebKit Commit Bot
Comment 12 2014-05-26 00:15:46 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.