You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Cong Wang <cw...@twopensource.com> on 2015/09/01 00:28:42 UTC
Re: Review Request 37903: stout: Fix bug in IPNetwork::create() with
zero prefix.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/37903/#review97170
-----------------------------------------------------------
Ship it!
Or we can simply make 'prefix' unsigned.
- Cong Wang
On Aug. 28, 2015, 8:02 p.m., Neil Conway wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/37903/
> -----------------------------------------------------------
>
> (Updated Aug. 28, 2015, 8:02 p.m.)
>
>
> Review request for mesos.
>
>
> Bugs: MESOS-3328
> https://issues.apache.org/jira/browse/MESOS-3328
>
>
> Repository: mesos
>
>
> Description
> -------
>
> The previous coding would try to shift a uint32_t value 32 bits to the left; per
> C++ spec, this yields undefined behavior. On my machine, this resulted in
> treating a prefix of 0 as equivalent to a prefix of 32, which is obviously
> wrong.
>
> Spotted via ubsan: see MESOS-3328.
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/3rdparty/stout/include/stout/ip.hpp 1ad119d54820e97497b1773518875be25ddbf98a
> 3rdparty/libprocess/3rdparty/stout/tests/ip_tests.cpp b0cbcb38cfcb923ec7c185bacf139ceb0a28924f
>
> Diff: https://reviews.apache.org/r/37903/diff/
>
>
> Testing
> -------
>
> make check
>
>
> Thanks,
>
> Neil Conway
>
>
Re: Review Request 37903: stout: Fix bug in IPNetwork::create() with
zero prefix.
Posted by Neil Conway <ne...@gmail.com>.
> On Aug. 31, 2015, 10:28 p.m., Cong Wang wrote:
> > Or we can simply make 'prefix' unsigned.
Thanks for the review!
As far as I know, making "prefix" unsigned would not help. The code in question is: "0xffffffff << (32 - prefix)". 0xffffffff is an unsigned integer literal -- left-shifting a 32-bit integer (0xffffffff) by 32 bits is undefined, regardless of sign.
- Neil
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/37903/#review97170
-----------------------------------------------------------
On Aug. 28, 2015, 8:02 p.m., Neil Conway wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/37903/
> -----------------------------------------------------------
>
> (Updated Aug. 28, 2015, 8:02 p.m.)
>
>
> Review request for mesos.
>
>
> Bugs: MESOS-3328
> https://issues.apache.org/jira/browse/MESOS-3328
>
>
> Repository: mesos
>
>
> Description
> -------
>
> The previous coding would try to shift a uint32_t value 32 bits to the left; per
> C++ spec, this yields undefined behavior. On my machine, this resulted in
> treating a prefix of 0 as equivalent to a prefix of 32, which is obviously
> wrong.
>
> Spotted via ubsan: see MESOS-3328.
>
>
> Diffs
> -----
>
> 3rdparty/libprocess/3rdparty/stout/include/stout/ip.hpp 1ad119d54820e97497b1773518875be25ddbf98a
> 3rdparty/libprocess/3rdparty/stout/tests/ip_tests.cpp b0cbcb38cfcb923ec7c185bacf139ceb0a28924f
>
> Diff: https://reviews.apache.org/r/37903/diff/
>
>
> Testing
> -------
>
> make check
>
>
> Thanks,
>
> Neil Conway
>
>