From 8f4b918c5bfc539402b774d6e51d5bb0b8874d21 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 12 Jul 2017 13:24:51 -0400 Subject: [PATCH] Check argument index --- fmt/format.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fmt/format.h b/fmt/format.h index d552abfc..b2a8995e 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -1626,10 +1626,12 @@ class basic_args { uint64_t num_args = -signed_types; return index < num_args ? args_[index] : format_arg(); } - if (index > internal::MAX_PACKED_ARGS) - return format_arg(); format_arg arg; + if (index > internal::MAX_PACKED_ARGS) + return arg; arg.type_ = type(index); + if (arg.type_ == internal::NONE) + return arg; internal::value &val = arg.value_; val = values_[index]; return arg;