[Webkit-unassigned] [Bug 198518] REGRESSION(r245586): static assertion failed: Match result and EncodedMatchResult should be the same size

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 24 13:03:20 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=198518

--- Comment #10 from Mark Lam <mark.lam at apple.com> ---
Comment on attachment 372782
  --> https://bugs.webkit.org/attachment.cgi?id=372782
proposed patch

View in context: https://bugs.webkit.org/attachment.cgi?id=372782&action=review

Also missing ChangeLog.

> Source/JavaScriptCore/runtime/MatchResult.h      2019-06-24 18:36:36.947345256 +0000:43
>  #if CPU(ARM64) || CPU(X86_64)
> +#define ENCODEDMATCHRESULT_IS_MATCHRESULT 1
>  using EncodedMatchResult = MatchResult;
> -#else
> +#elif (defined(SIZE_WIDTH) && (SIZE_WIDTH == 32)) || (SIZE_MAX == 0xffffffff)
> +#define ENCODEDMATCHRESULT_IS_MATCHRESULT 0
>  using EncodedMatchResult = uint64_t;
> +#else
> +#define ENCODEDMATCHRESULT_IS_MATCHRESULT 1
> +using EncodedMatchResult = MatchResult;
>  #endif

This fix is invalid.

The issue is that MatchResult contains 2 size_t values.  This means, on 32-bit platforms, sizeof(MatchResult) is 64-bit, but on 64-bit platforms, sizeof(MatchResult) is 128-bit.

The proper fix is simply:

#if CPU(ADDRESS32)
using EncodedMatchResult = uint64_t;
static_assert(sizeof(size_t) == sizeof(uint32_t), "");
#else
using EncodedMatchResult = MatchResult;
#endif

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190624/d503d6ba/attachment.html>


More information about the webkit-unassigned mailing list