diff --git a/libstdc++-v3/include/std/spanstream b/libstdc++-v3/include/std/spanstream index 98ad3fa856a78ef63bf17bf950ee106954a57135..23a340a746e886b5923e3e67c6159e63b04db7b7 100644 --- a/libstdc++-v3/include/std/spanstream +++ b/libstdc++-v3/include/std/spanstream @@ -168,7 +168,7 @@ template<typename _CharT, typename _Traits> } else { - off_type __base; + off_type __base{}; __which &= (ios_base::in|ios_base::out); if (__which == ios_base::out) @@ -182,11 +182,13 @@ template<typename _CharT, typename _Traits> } else if (__way == ios_base::end) __base = _M_buf.size(); + else /* way is not ios::beg, ios::cur, or ios::end */ [[unlikely]] + return __ret; - if (__builtin_add_overflow(__base, __off, &__off)) + if (__builtin_add_overflow(__base, __off, &__off)) [[unlikely]] return __ret; - if (__off < 0 || __off > _M_buf.size()) + if (__off < 0 || __off > _M_buf.size()) [[unlikely]] return __ret; if (__which & ios_base::in)