================
@@ -1908,21 +1909,36 @@ bool UnwindCursor<A, 
R>::getInfoFromCompactEncodingSection(
       }
     }
     encoding = pageIndex.encoding(low);
-    funcStart = pageIndex.functionOffset(low) + sects.dso_base;
+    rangeStart = pageIndex.functionOffset(low) + sects.dso_base;
+
+    // If UNWIND_IS_NOT_FUNCTION_START is set, walk backwards to find the 
actual
+    // function start.
+    funcStart = rangeStart;
+    if (encoding & UNWIND_IS_NOT_FUNCTION_START) {
+      uint32_t backIndex = low;
+      do {
+        --backIndex;
+      } while (backIndex > 0 &&
----------------
kovdan01 wrote:

Do we have a guarantee that `low` is greater than 0?

If no, we might potentially end up with `backIndex` equal to `UINT32_MAX` 
(after first decrement) which does not look as intended behavior.

If yes, it's probably worth adding a corresponding assertion

https://github.com/llvm/llvm-project/pull/202772
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to