Skip to content

Compilation errors (VS 2022 32-bit /W3 /SDL) #278

Open
@Kemp-J

Description

@Kemp-J

When building a project that uses the jwt-cpp header in Visual Studio 2022 with warning level 3 and SDL checks enabled there are several errors raised related to suspicious implicit casts. These can be easily solved with a few tweaks. Specifically:

  • The value returned by jwt::alphabet::index is currently a uint32_t, which is smaller than the ptrdiff_t that the call to std::distance returns. The return value can be switched to size_t to solve this.
  • The sextet_* and triple variables in jwt::base::details::decode call the above and so need to be size_t as well.

In modern C++ both of the above points can be solved with auto in preference to specifying the types.

  • The argument passed to system_clock::from_time_t in jwt::basic_claim::as_date requires a static_cast to a time_t.

I was going to raise an issue about a common base class for exceptions, but it looks like someone got there first :)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions