Commit d5f7e049 by Jonathan Wakely Committed by Jonathan Wakely

Fix array index error in address_v6 comparisons

	* include/experimental/internet (operator==, operator<): Fix loop
	condition to avoid reading past the end of the array.

From-SVN: r276153
parent 8eb60b2f
2019-09-26 Jonathan Wakely <jwakely@redhat.com> 2019-09-26 Jonathan Wakely <jwakely@redhat.com>
* include/experimental/internet (operator==, operator<): Fix loop
condition to avoid reading past the end of the array.
* include/std/array: Remove references to profile mode. * include/std/array: Remove references to profile mode.
* include/std/bitset: Likewise. * include/std/bitset: Likewise.
* include/std/deque: Likewise. * include/std/deque: Likewise.
......
...@@ -539,7 +539,7 @@ namespace ip ...@@ -539,7 +539,7 @@ namespace ip
const auto& __aa = __a._M_bytes; const auto& __aa = __a._M_bytes;
const auto& __bb = __b._M_bytes; const auto& __bb = __b._M_bytes;
int __i = 0; int __i = 0;
for (; __aa[__i] == __bb[__i] && __i < 16; ++__i) for (; __i < 16 && __aa[__i] == __bb[__i]; ++__i)
; ;
return __i == 16 ? __a.scope_id() == __b.scope_id() : false; return __i == 16 ? __a.scope_id() == __b.scope_id() : false;
} }
...@@ -554,7 +554,7 @@ namespace ip ...@@ -554,7 +554,7 @@ namespace ip
const auto& __aa = __a._M_bytes; const auto& __aa = __a._M_bytes;
const auto& __bb = __b._M_bytes; const auto& __bb = __b._M_bytes;
int __i = 0; int __i = 0;
for (; __aa[__i] == __bb[__i] && __i < 16; ++__i) for (; __i < 16 && __aa[__i] == __bb[__i]; ++__i)
; ;
return __i == 16 ? __a.scope_id() < __b.scope_id() : __aa[__i] < __bb[__i]; return __i == 16 ? __a.scope_id() < __b.scope_id() : __aa[__i] < __bb[__i];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment