diff --git a/gitstatus/mbuild b/gitstatus/mbuild index 40316fdf..d3de3317 100755 --- a/gitstatus/mbuild +++ b/gitstatus/mbuild @@ -94,7 +94,9 @@ setopt no_unset extended_glob pipe_fail prompt_percent typeset_silent \ no_prompt_subst no_prompt_bang pushd_silent warn_create_global -if [[ $ZSH_VERSION != (5.<1->*|<6->.*) || $ZSH_VERSION == 5.4(|.*) ]]; then +autoload -Uz is-at-least + +if ! is-at-least 5.1 || [[ $ZSH_VERSION == 5.4.* ]]; then print -ru2 -- "[error] unsupported zsh version: $ZSH_VERSION" return 1 fi diff --git a/gitstatus/src/arena.h b/gitstatus/src/arena.h index 569833ca..96873852 100644 --- a/gitstatus/src/arena.h +++ b/gitstatus/src/arena.h @@ -27,6 +27,7 @@ #include #include +#include "check.h" #include "string_view.h" namespace gitstatus { @@ -94,6 +95,7 @@ class Arena { template inline T* Allocate(size_t n) { static_assert(!std::is_reference(), ""); + CHECK(n <= SIZE_MAX / sizeof(T)) << n; return static_cast(Allocate(n * sizeof(T), alignof(T))); }