| 1990 | } |
| 1991 | |
| 1992 | static int numericBoundaryCheck(typeData data, long long ll, const char **err) { |
| 1993 | if (data.numeric.numeric_type == NUMERIC_TYPE_ULONG_LONG || |
| 1994 | data.numeric.numeric_type == NUMERIC_TYPE_UINT || |
| 1995 | data.numeric.numeric_type == NUMERIC_TYPE_SIZE_T) { |
| 1996 | /* Boundary check for unsigned types */ |
| 1997 | unsigned long long ull = ll; |
| 1998 | unsigned long long upper_bound = data.numeric.upper_bound; |
| 1999 | unsigned long long lower_bound = data.numeric.lower_bound; |
| 2000 | if (ull > upper_bound || ull < lower_bound) { |
| 2001 | snprintf(loadbuf, LOADBUF_SIZE, |
| 2002 | "argument must be between %llu and %llu inclusive", |
| 2003 | lower_bound, |
| 2004 | upper_bound); |
| 2005 | *err = loadbuf; |
| 2006 | return 0; |
| 2007 | } |
| 2008 | } else { |
| 2009 | /* Boundary check for signed types */ |
| 2010 | if (ll > data.numeric.upper_bound || ll < data.numeric.lower_bound) { |
| 2011 | snprintf(loadbuf, LOADBUF_SIZE, |
| 2012 | "argument must be between %lld and %lld inclusive", |
| 2013 | data.numeric.lower_bound, |
| 2014 | data.numeric.upper_bound); |
| 2015 | *err = loadbuf; |
| 2016 | return 0; |
| 2017 | } |
| 2018 | } |
| 2019 | return 1; |
| 2020 | } |
| 2021 | |
| 2022 | static int numericConfigSet(typeData data, sds value, int update, const char **err) { |
| 2023 | long long ll, prev = 0; |
no test coverage detected