Add cpp-httplib local modification to correct sign comparison error. [crashpad/crashpad : main]

1 view
Skip to first unread message

Justin Cohen (Gerrit)

unread,
Feb 10, 2026, 5:04:15 PM (12 days ago) Feb 10
to Joshua Peraza, Crashpad LUCI CQ, crashp...@chromium.org
Attention needed from Joshua Peraza

Justin Cohen voted and added 1 comment

Votes added by Justin Cohen

Code-Review+1
Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Justin Cohen . resolved

ptal

Open in Gerrit

Related details

Attention is currently required from:
  • Joshua Peraza
Submit Requirements:
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: crashpad/crashpad
Gerrit-Branch: main
Gerrit-Change-Id: If24ef33b3838bf90e1f1c79a3869892aa9209c7c
Gerrit-Change-Number: 7563115
Gerrit-PatchSet: 1
Gerrit-Owner: Justin Cohen <justi...@google.com>
Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
Gerrit-Reviewer: Justin Cohen <justi...@google.com>
Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
Gerrit-Comment-Date: Tue, 10 Feb 2026 22:04:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Mark Mentovai (Gerrit)

unread,
Feb 10, 2026, 5:32:02 PM (12 days ago) Feb 10
to Justin Cohen, Joshua Peraza, Crashpad LUCI CQ, crashp...@chromium.org
Attention needed from Joshua Peraza and Justin Cohen

Mark Mentovai added 3 comments

Commit Message
Line 8, Patchset 1 (Latest):
Mark Mentovai . unresolved

You should share the error here.

You should also say what steps you’ve taken to upstream this, or if you haven’t upstreamed, why not.

File third_party/cpp-httplib/cpp-httplib/httplib.h
Line 10923, Patchset 1 (Latest): const int num_objs = static_cast<int>(sk_X509_OBJECT_num(objs));
Mark Mentovai . unresolved

Can you do this without the cast at all? Assignments should be subject to more lax rules than comparisons.

Line 10923, Patchset 1 (Parent): for (int i = 0; i < sk_X509_OBJECT_num(objs); i++) {
Mark Mentovai . unresolved

This is already an `int` in the headers I’ve looked at. What SSL library is in use when this breaks? (This is why you should show the error, and include a link to where you saw it.)

Open in Gerrit

Related details

Attention is currently required from:
  • Joshua Peraza
  • Justin Cohen
Submit Requirements:
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: crashpad/crashpad
    Gerrit-Branch: main
    Gerrit-Change-Id: If24ef33b3838bf90e1f1c79a3869892aa9209c7c
    Gerrit-Change-Number: 7563115
    Gerrit-PatchSet: 1
    Gerrit-Owner: Justin Cohen <justi...@google.com>
    Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Reviewer: Justin Cohen <justi...@google.com>
    Gerrit-CC: Mark Mentovai <ma...@chromium.org>
    Gerrit-Attention: Justin Cohen <justi...@google.com>
    Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
    Gerrit-Comment-Date: Tue, 10 Feb 2026 22:31:59 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Justin Cohen (Gerrit)

    unread,
    Feb 10, 2026, 7:02:13 PM (12 days ago) Feb 10
    to Mark Mentovai, Joshua Peraza, Crashpad LUCI CQ, crashp...@chromium.org
    Attention needed from Joshua Peraza and Mark Mentovai

    Justin Cohen voted and added 3 comments

    Votes added by Justin Cohen

    Code-Review+0
    Commit-Queue+1

    3 comments

    Commit Message
    Line 8, Patchset 1:
    Mark Mentovai . resolved

    You should share the error here.

    You should also say what steps you’ve taken to upstream this, or if you haven’t upstreamed, why not.

    Justin Cohen

    There appear to be a lot of local modifications, so while there's only one call to sk_X509_OBJECT_num in our repo, there are 4 upstream. I wanted to at least get through this review.

    I'll update the description with the error details.

    File third_party/cpp-httplib/cpp-httplib/httplib.h
    Line 10923, Patchset 1: const int num_objs = static_cast<int>(sk_X509_OBJECT_num(objs));
    Mark Mentovai . resolved

    Can you do this without the cast at all? Assignments should be subject to more lax rules than comparisons.

    Justin Cohen

    Yes, `const int num_objs = sk_X509_OBJECT_num(objs);` works, I'll update to that.

    Line 10923, Patchset 1 (Parent): for (int i = 0; i < sk_X509_OBJECT_num(objs); i++) {
    Mark Mentovai . resolved

    This is already an `int` in the headers I’ve looked at. What SSL library is in use when this breaks? (This is why you should show the error, and include a link to where you saw it.)

    Justin Cohen

    There seems to be a bunch of macros at work in BoringSSL causing this. Compiling Chromium with -E I see:

    inline size_t sk_X509_OBJECT_num(const struct stack_st_X509_OBJECT *sk) { return OPENSSL_sk_num((const OPENSSL_STACK *)sk); }

    I tried to make a minified sample using httplib and boringssl but couldn't get the same setup as Chromium.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Joshua Peraza
    • Mark Mentovai
    Submit Requirements:
      • requirement satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: crashpad/crashpad
      Gerrit-Branch: main
      Gerrit-Change-Id: If24ef33b3838bf90e1f1c79a3869892aa9209c7c
      Gerrit-Change-Number: 7563115
      Gerrit-PatchSet: 4
      Gerrit-Owner: Justin Cohen <justi...@google.com>
      Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
      Gerrit-Reviewer: Justin Cohen <justi...@google.com>
      Gerrit-CC: Mark Mentovai <ma...@chromium.org>
      Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
      Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
      Gerrit-Comment-Date: Wed, 11 Feb 2026 00:02:11 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Justin Cohen (Gerrit)

      unread,
      Feb 10, 2026, 7:13:15 PM (12 days ago) Feb 10
      to Mark Mentovai, Joshua Peraza, Crashpad LUCI CQ, crashp...@chromium.org
      Attention needed from Joshua Peraza and Mark Mentovai

      Justin Cohen added 1 comment

      Commit Message
      Mark Mentovai . resolved

      You should share the error here.

      You should also say what steps you’ve taken to upstream this, or if you haven’t upstreamed, why not.

      Justin Cohen

      There appear to be a lot of local modifications, so while there's only one call to sk_X509_OBJECT_num in our repo, there are 4 upstream. I wanted to at least get through this review.

      I'll update the description with the error details.

      Justin Cohen

      PR here: https://github.com/yhirose/cpp-httplib/pull/2355, noted in CL description

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Joshua Peraza
      • Mark Mentovai
      Submit Requirements:
      • requirement satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: crashpad/crashpad
      Gerrit-Branch: main
      Gerrit-Change-Id: If24ef33b3838bf90e1f1c79a3869892aa9209c7c
      Gerrit-Change-Number: 7563115
      Gerrit-PatchSet: 6
      Gerrit-Owner: Justin Cohen <justi...@google.com>
      Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
      Gerrit-Reviewer: Justin Cohen <justi...@google.com>
      Gerrit-CC: Mark Mentovai <ma...@chromium.org>
      Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
      Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
      Gerrit-Comment-Date: Wed, 11 Feb 2026 00:13:11 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
      Comment-In-Reply-To: Justin Cohen <justi...@google.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Mark Mentovai (Gerrit)

      unread,
      Feb 10, 2026, 8:25:48 PM (12 days ago) Feb 10
      to Justin Cohen, Joshua Peraza, Crashpad LUCI CQ, crashp...@chromium.org
      Attention needed from Joshua Peraza and Justin Cohen

      Mark Mentovai added 1 comment

      Commit Message
      Line 9, Patchset 6 (Latest):In some build configurations, sk_X509_OBJECT_num (from BoringSSL)
      Mark Mentovai . unresolved

      Oh, does BoringSSL also use `size_t` as `sk_X509_OBJECT_VALUE`’s parameter’s type?

      If so, this would be a good time to deploy `auto` and `decltype`, or use other modern C++ magic to get at the type you need.

      ```
      auto count = sk_X509_OBJECT_num(objs);
      for (decltype(count) i = 0; i < count; i++) {
      ```

      I took your `const` away because you don’t want `i` to be `const`. Too bad, I liked the `const` on `count`, actually. You could put it back (`auto const count = …`, or order the `const` in the more traditional but decidedly barbaric way) and remove it from `i` with `std::remove_const_t<decltype(count)>` from `<type_traits>`, or `std::remove_const<decltype(count)>::type` if you need pre-C++14 compatibility, which hopefully you do not.

      This should be totally compatible with any TLS library with an OpenSSL-like interface (including both OpenSSL and BoringSSL) as long as it uses the a stack count and index type consistently.

      This preserves BoringSSL’s (superior) interface enhancements when using BoringSSL, while still remaining fully compatible with classic OpenSSL.

      If you don’t like `decltype`, the other magic I have in mind that you can substitute is `std::invoke_result_t` if C++17 is assured, but I like that less because it’s library (`<type_traits>`), not language (but this is concededly a weak argument if you’re already using `std::remove_const_t`); it had a different name before C++17 if that’s important; and it’s wordier without any real clear gain.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Joshua Peraza
      • Justin Cohen
      Submit Requirements:
        • requirement satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: crashpad/crashpad
        Gerrit-Branch: main
        Gerrit-Change-Id: If24ef33b3838bf90e1f1c79a3869892aa9209c7c
        Gerrit-Change-Number: 7563115
        Gerrit-PatchSet: 6
        Gerrit-Owner: Justin Cohen <justi...@google.com>
        Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
        Gerrit-Reviewer: Justin Cohen <justi...@google.com>
        Gerrit-CC: Mark Mentovai <ma...@chromium.org>
        Gerrit-Attention: Justin Cohen <justi...@google.com>
        Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
        Gerrit-Comment-Date: Wed, 11 Feb 2026 01:25:44 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Justin Cohen (Gerrit)

        unread,
        Feb 10, 2026, 8:29:02 PM (12 days ago) Feb 10
        to Mark Mentovai, Joshua Peraza, Crashpad LUCI CQ, crashp...@chromium.org
        Attention needed from Joshua Peraza and Mark Mentovai

        Justin Cohen added 1 comment

        Commit Message
        Line 9, Patchset 6:In some build configurations, sk_X509_OBJECT_num (from BoringSSL)
        Mark Mentovai . resolved

        Oh, does BoringSSL also use `size_t` as `sk_X509_OBJECT_VALUE`’s parameter’s type?

        If so, this would be a good time to deploy `auto` and `decltype`, or use other modern C++ magic to get at the type you need.

        ```
        auto count = sk_X509_OBJECT_num(objs);
        for (decltype(count) i = 0; i < count; i++) {
        ```

        I took your `const` away because you don’t want `i` to be `const`. Too bad, I liked the `const` on `count`, actually. You could put it back (`auto const count = …`, or order the `const` in the more traditional but decidedly barbaric way) and remove it from `i` with `std::remove_const_t<decltype(count)>` from `<type_traits>`, or `std::remove_const<decltype(count)>::type` if you need pre-C++14 compatibility, which hopefully you do not.

        This should be totally compatible with any TLS library with an OpenSSL-like interface (including both OpenSSL and BoringSSL) as long as it uses the a stack count and index type consistently.

        This preserves BoringSSL’s (superior) interface enhancements when using BoringSSL, while still remaining fully compatible with classic OpenSSL.

        If you don’t like `decltype`, the other magic I have in mind that you can substitute is `std::invoke_result_t` if C++17 is assured, but I like that less because it’s library (`<type_traits>`), not language (but this is concededly a weak argument if you’re already using `std::remove_const_t`); it had a different name before C++17 if that’s important; and it’s wordier without any real clear gain.

        Justin Cohen

        Done. I'll update the PR too.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Joshua Peraza
        • Mark Mentovai
        Submit Requirements:
          • requirement satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: crashpad/crashpad
          Gerrit-Branch: main
          Gerrit-Change-Id: If24ef33b3838bf90e1f1c79a3869892aa9209c7c
          Gerrit-Change-Number: 7563115
          Gerrit-PatchSet: 7
          Gerrit-Owner: Justin Cohen <justi...@google.com>
          Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
          Gerrit-Reviewer: Justin Cohen <justi...@google.com>
          Gerrit-CC: Mark Mentovai <ma...@chromium.org>
          Gerrit-Attention: Mark Mentovai <ma...@chromium.org>
          Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
          Gerrit-Comment-Date: Wed, 11 Feb 2026 01:28:59 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Mark Mentovai <ma...@chromium.org>
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Mark Mentovai (Gerrit)

          unread,
          Feb 10, 2026, 9:15:13 PM (12 days ago) Feb 10
          to Justin Cohen, Joshua Peraza, Crashpad LUCI CQ, crashp...@chromium.org
          Attention needed from Joshua Peraza and Justin Cohen

          Mark Mentovai voted and added 3 comments

          Votes added by Mark Mentovai

          Code-Review+1

          3 comments

          Patchset-level comments
          File-level comment, Patchset 7 (Latest):
          Mark Mentovai . resolved

          C++ magic!

          Commit Message
          Line 7, Patchset 7 (Latest):Add cpp-httplib local modification to correct sign comparison error.
          Mark Mentovai . unresolved

          I think “BoringSSL compatibility” is more important and belongs here in the summary line. You should still talk about -Wsign-compare below, but there are only so many things you can fit in the first line.

          File third_party/cpp-httplib/README.crashpad
          Line 28, Patchset 7 (Latest): - Correct sign compare error in sk_X509_OBJECT_num.
          Mark Mentovai . unresolved

          Say that this is for BoringSSL compatibility.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Joshua Peraza
          • Justin Cohen
          Submit Requirements:
          • requirement satisfiedCode-Owners
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: crashpad/crashpad
          Gerrit-Branch: main
          Gerrit-Change-Id: If24ef33b3838bf90e1f1c79a3869892aa9209c7c
          Gerrit-Change-Number: 7563115
          Gerrit-PatchSet: 7
          Gerrit-Owner: Justin Cohen <justi...@google.com>
          Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
          Gerrit-Reviewer: Justin Cohen <justi...@google.com>
          Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
          Gerrit-Attention: Justin Cohen <justi...@google.com>
          Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
          Gerrit-Comment-Date: Wed, 11 Feb 2026 02:15:10 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Mark Mentovai (Gerrit)

          unread,
          Feb 10, 2026, 9:15:35 PM (12 days ago) Feb 10
          to Justin Cohen, Joshua Peraza, Crashpad LUCI CQ, crashp...@chromium.org
          Attention needed from Joshua Peraza and Justin Cohen

          Mark Mentovai voted and added 1 comment

          Votes added by Mark Mentovai

          Code-Review+0

          1 comment

          Patchset-level comments
          Mark Mentovai . resolved

          Phone gnubby didn't work.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Joshua Peraza
          • Justin Cohen
          Submit Requirements:
          • requirement satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: crashpad/crashpad
          Gerrit-Branch: main
          Gerrit-Change-Id: If24ef33b3838bf90e1f1c79a3869892aa9209c7c
          Gerrit-Change-Number: 7563115
          Gerrit-PatchSet: 7
          Gerrit-Owner: Justin Cohen <justi...@google.com>
          Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
          Gerrit-Reviewer: Justin Cohen <justi...@google.com>
          Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
          Gerrit-Attention: Justin Cohen <justi...@google.com>
          Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
          Gerrit-Comment-Date: Wed, 11 Feb 2026 02:15:32 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Mark Mentovai (Gerrit)

          unread,
          Feb 10, 2026, 9:16:56 PM (12 days ago) Feb 10
          to Justin Cohen, Joshua Peraza, Crashpad LUCI CQ, crashp...@chromium.org
          Attention needed from Joshua Peraza and Justin Cohen

          Mark Mentovai voted and added 1 comment

          Votes added by Mark Mentovai

          Code-Review+1

          1 comment

          Patchset-level comments
          Mark Mentovai . resolved

          LGTM with the requested documentary changes.

          (Trying gnubby from non-phone. Wish me luck!)

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Joshua Peraza
          • Justin Cohen
          Submit Requirements:
          • requirement satisfiedCode-Owners
          • requirement satisfiedCode-Review
          • requirement is not satisfiedNo-Unresolved-Comments
          • requirement satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: crashpad/crashpad
          Gerrit-Branch: main
          Gerrit-Change-Id: If24ef33b3838bf90e1f1c79a3869892aa9209c7c
          Gerrit-Change-Number: 7563115
          Gerrit-PatchSet: 7
          Gerrit-Owner: Justin Cohen <justi...@google.com>
          Gerrit-Reviewer: Joshua Peraza <jpe...@chromium.org>
          Gerrit-Reviewer: Justin Cohen <justi...@google.com>
          Gerrit-Reviewer: Mark Mentovai <ma...@chromium.org>
          Gerrit-Attention: Justin Cohen <justi...@google.com>
          Gerrit-Attention: Joshua Peraza <jpe...@chromium.org>
          Gerrit-Comment-Date: Wed, 11 Feb 2026 02:16:53 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy
          Reply all
          Reply to author
          Forward
          0 new messages