mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
* Check for overflow in incrementWeak(). This mirrors what is currently done for unowned reference counts, where overflowing the side table field produces a fatal error. Without this, the count silently wrapped from 2^31-1 to 0, which then caused breakage when the balancing releases happened (possibly including use-after-free bugs). * Fix the implementation of RefCounts::getWeakCount(). The previous implementation was only appropriate for heap objects, but not side tables. This resulted in the weak count always returning 0 or 1. This change specializes the implementation for the two different cases and returns the correct count for side tables. * Test large weak retain counts. This tests the largest allowed weak retain count, as well as the overflow check when that count is exceeded.
7.2 KiB
7.2 KiB