diff --git a/infer/src/clang/cType_to_sil_type.ml b/infer/src/clang/cType_to_sil_type.ml index 6fe3f111a..36695deb9 100644 --- a/infer/src/clang/cType_to_sil_type.ml +++ b/infer/src/clang/cType_to_sil_type.ml @@ -35,7 +35,7 @@ let type_desc_of_builtin_type_kind builtin_type_kind = | `WChar_S | `Char16 | `Char32 -> Typ.Tint IChar - | `UShort + | `UShort -> Typ.Tint IUShort | `Short -> Typ.Tint IShort | `UInt | `UInt128 -> Typ.Tint IUInt diff --git a/infer/tests/codetoanalyze/c/bufferoverrun/arith.c b/infer/tests/codetoanalyze/c/bufferoverrun/arith.c index 0b38ac5a1..19717db8a 100644 --- a/infer/tests/codetoanalyze/c/bufferoverrun/arith.c +++ b/infer/tests/codetoanalyze/c/bufferoverrun/arith.c @@ -6,6 +6,7 @@ * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ +#include void modulo_signed_Bad(int i) { char arr[5]; @@ -44,6 +45,11 @@ void modulo_unsigned_Good(unsigned int i) { arr[i % 5] = 123; } +void modulo_unsigned_short_Good(uint16_t i) { + char arr[5]; + arr[i % 5] = 123; +} + void modulo_signed_var_Bad_FN(unsigned int len, int i) { char arr[len]; arr[i % len] = 123;