[PATCH] D35891: [Support/GlobPattern] - Do not crash when pattern has characters with int value < 0.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 27 01:07:56 PDT 2017


grimar added inline comments.


================
Comment at: lib/Support/GlobPattern.cpp:39
     if (S[1] != '-') {
-      BV[S[0]] = true;
+      BV[(uint8_t)S[0]] = true;
       S = S.substr(1);
----------------
grimar wrote:
> ruiu wrote:
> > Instead of casting to `uint8_t`, cast to `unsigned`.
> That will not work:
> 
> ```
> (unsigned)0xFF == 0xFFFFFFFF == 4294967295
> (uint8_t)0xFF == 255
> ```
> 
I was mean
```
(unsigned)(char)0xFF == 4294967295
```


https://reviews.llvm.org/D35891





More information about the llvm-commits mailing list