[clang] Avoid printing overly large integer. (PR #75902)

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 23 18:44:42 PST 2023


================
@@ -17132,6 +17132,10 @@ static bool ConvertAPValueToString(const APValue &V, QualType T,
         case BuiltinType::WChar_U: {
           unsigned TyWidth = Context.getIntWidth(T);
           assert(8 <= TyWidth && TyWidth <= 32 && "Unexpected integer width");
+          if (V.getInt() > std::numeric_limits<uint64_t>::max() ||
----------------
topperc wrote:

Is the right place to fix the original issue? The code right below this seems to be printing in hex, but the bug report shows a long decimal value. Also I'm not sure why _BitInt would got through any of the BuiltinTypes listed in this switch.

Is the later call to V.getInt().toString(Str); on line 17153 the right place?

https://github.com/llvm/llvm-project/pull/75902


More information about the cfe-commits mailing list