Closed Bug 1402362 Opened 7 years ago Closed 7 years ago

nsURLHelper.h: performing pointer arithmetic on a null pointer has undefined behavior if the offset is nonzero [-Werror,-Wnull-pointer-arithmetic]

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: Sylvestre, Assigned: andi)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Building Firefox trunk with enable-warning-as-error with clang trunk is failing on:

In file included from /data/jenkins/workspace/firefox-clang-last/obj-x86_64-pc-linux-gnu/security/manager/ssl/Unified_cpp_security_manager_ssl0.cpp:110:
In file included from /data/jenkins/workspace/firefox-clang-last/security/manager/ssl/SSLServerCertVerification.cpp:132:
/data/jenkins/workspace/firefox-clang-last/obj-x86_64-pc-linux-gnu/dist/include/nsURLHelper.h:228:35: error: performing pointer arithmetic on a null pointer has undefined behavior if the offset is nonzero [-Werror,-Wnull-pointer-arithmetic]
     return net_FindCharInSet(str, NET_MAX_ADDRESS, set);
                                   ^~~~~~~~~~~~~~~
 /data/jenkins/workspace/firefox-clang-last/obj-x86_64-pc-linux-gnu/dist/include/nsURLHelper.h:224:36: note: expanded from macro 'NET_MAX_ADDRESS'
 #define NET_MAX_ADDRESS (((char*)0)-1)
                          ~~~~~~~~~~^
 /data/jenkins/workspace/firefox-clang-last/obj-x86_64-pc-linux-gnu/dist/include/nsURLHelper.h:232:38: error: performing pointer arithmetic on a null pointer has undefined behavior if the offset is nonzero [-Werror,-Wnull-pointer-arithmetic]
     return net_FindCharNotInSet(str, NET_MAX_ADDRESS, set);
                                      ^~~~~~~~~~~~~~~
 /data/jenkins/workspace/firefox-clang-last/obj-x86_64-pc-linux-gnu/dist/include/nsURLHelper.h:224:36: note: expanded from macro 'NET_MAX_ADDRESS'
 1:06.57 #define NET_MAX_ADDRESS (((char*)0)-1)
 1:06.57                          ~~~~~~~~~~^
 1:07.96 2 errors generated.
Looks like it is caused by this upstream change:
https://reviews.llvm.org/D37042
Comment on attachment 8912653 [details]
Bug 1402362 - modified NET_MAX_ADDRESS to have UINTPTR_MAX value.

https://reviewboard.mozilla.org/r/183982/#review189170
Attachment #8912653 - Flags: review?(valentin.gosu) → review+
Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/74462a725efc
modified NET_MAX_ADDRESS to have UINTPTR_MAX value. r=valentin
https://hg.mozilla.org/mozilla-central/rev/74462a725efc
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Assignee: nobody → bpostelnicu
No longer blocks: clang-based-analysis
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: