[llvm] [llvm][utils] Improve the StringRef summary provider (PR #162298)
    Dave Lee via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Oct 22 09:30:07 PDT 2025
    
    
  
================
@@ -197,6 +197,13 @@ def StringRefSummaryProvider(valobj, internal_dict):
         return '""'
 
     data = data_pointer.deref
+    # StringRef may be uninitialized with length exceeding available memory,
+    # potentially causing bad_alloc exceptions. Limit the length to max string summary setting.
+    limit_obj = (
+        valobj.GetTarget().GetDebugger().GetSetting("target.max-string-summary-length")
----------------
kastiglione wrote:
it's only a style comment, but this can also be:
```suggestion
        valobj.target.debugger.GetSetting("target.max-string-summary-length")
```
https://github.com/llvm/llvm-project/pull/162298
    
    
More information about the llvm-commits
mailing list