Skip to content

Commit 4218317

Browse files
committed
- Regression when destroying a BackedArenaAllocator in some cases #3332.
- `"a::b:c:d:e:f:0"` was not parsed as a valid ipv6 string.
1 parent 609a7dd commit 4218317

4 files changed

Lines changed: 21 additions & 1 deletion

File tree

lib/std/core/allocators/backed_arena_allocator.c3

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ fn void BackedArenaAllocator.reset(&self, sz mark)
7676
ExtraPage *last_page = self.last_page;
7777
while (last_page && last_page.mark > mark)
7878
{
79+
self.used = last_page.mark;
7980
ExtraPage *to_free = last_page;
8081
last_page = last_page.prev_page;
8182
_free_page(self, to_free)!!;

lib/std/net/inetaddr.c3

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn InetAddress? ipv6_from_str(String s)
9898
// Check that this is the first ::
9999
if (found_zero) return INVALID_IP_STRING~;
100100
// Also check that the zeroed section is at least 2
101-
if (zero_segment_len < 2) return INVALID_IP_STRING~;
101+
if (zero_segment_len < 1) return INVALID_IP_STRING~;
102102
// Skip (will be zero by default
103103
index += zero_segment_len;
104104
found_zero = true;

releasenotes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
### Fixes
1414
- `$stringify` would sometimes include parens.
15+
- Regression when destroying a BackedArenaAllocator in some cases #3332.
16+
- `"a::b:c:d:e:f:0"` was not parsed as a valid ipv6 string.
1517

1618
## 0.8.1 Change list
1719

test/unit/stdlib/net/inetaddr.c3

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,23 @@ fn void test_ipv6()
4848
assert(foo.ip6.val == 42541956123769884636017138956568135816);
4949
}
5050

51+
fn void test_ipv6_parse()
52+
{
53+
assert(net::ipv6_from_str("a::b:c:d:e:f:0")!!.to_tstring() == "000a:0000:000b:000c:000d:000e:000f:0000");
54+
assert(net::ipv6_from_str("1:2:3:4:5:6:7::")!!.to_tstring() == "0001:0002:0003:0004:0005:0006:0007:0000");
55+
assert(net::ipv6_from_str("::2:3:4:5:6:7:8")!!.to_tstring() == "0000:0002:0003:0004:0005:0006:0007:0008");
56+
assert(net::ipv6_from_str("1:2:3:4:5:6::8")!!.to_tstring() == "0001:0002:0003:0004:0005:0006:0000:0008");
57+
assert(net::ipv6_from_str("1:2:3:4:5:6:7:8")!!.to_tstring() == "0001:0002:0003:0004:0005:0006:0007:0008");
58+
59+
assert(@catch(net::ipv6_from_str("1:2:3:4:5:6:7:8:9")));
60+
assert(@catch(net::ipv6_from_str("1:2:3:4:5:6:7")));
61+
assert(@catch(net::ipv6_from_str("1:2:3:4:5:6:7:8::")));
62+
assert(@catch(net::ipv6_from_str("1::2:3:4:5:6:7:8")));
63+
assert(@catch(net::ipv6_from_str("1::2::3")));
64+
assert(@catch(net::ipv6_from_str("12345::1")));
65+
assert(@catch(net::ipv6_from_str("xyz::1")));
66+
}
67+
5168
fn void test_is_loopback()
5269
{
5370
assert(net::ipv4_from_str("127.0.0.1")!!.is_loopback());

0 commit comments

Comments
 (0)