Open
Description
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 auint32_t
, which is smaller than theptrdiff_t
that the call tostd::distance
returns. The return value can be switched tosize_t
to solve this. - The
sextet_*
andtriple
variables injwt::base::details::decode
call the above and so need to besize_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
injwt::basic_claim::as_date
requires astatic_cast
to atime_t
.
I was going to raise an issue about a common base class for exceptions, but it looks like someone got there first :)