Opened 6 years ago

Last modified 5 years ago

#12926 new Bugs

UBSAN complains about "left shift of negative value -4" from boost::icl::interval_bounds::reverse_right()

Reported by: tgrabiec@… Owned by: Joachim Faulhaber
Milestone: To Be Determined Component: ICL
Version: Boost 1.62.0 Severity: Problem
Keywords: Cc: tgrabiec@…, dnanar@…

Description

/usr/include/boost/icl/interval_bounds.hpp:45:74: runtime error: left shift of negative value -4
    #0 0x2e91091 in boost::icl::interval_bounds::reverse_right() const /usr/include/boost/icl/interval_bounds.hpp:45
    #1 0x2eec8cc in boost::enable_if<boost::icl::has_dynamic_bounds<boost::icl::continuous_interval<compatible_ring_position, std::less> >, boost::icl::continuous_interval<compatible_ring_position, std::less>::bounded_domain_type>::type boost::icl::reverse_bounded_upper<boost::icl::continuous_interval<compatible_ring_position, std::less> >(boost::icl::continuous_interval<compatible_ring_position, std::less> const&) /usr/include/boost/icl/concept/interval.hpp:509

boost-1.60.0-8.fc24.x86_64

Change History (2)

comment:1 by dnanar@…, 6 years ago

Cc: dnanar@… added
Version: Boost 1.60.0Boost 1.62.0

Same problem here, different use case:

interval_set<uint32_t> a;
a.insert({50,4294967295});
a.insert({25,4294967295});

causes this. Debian stock libboost package (Version: 1.62.0.1). The exact error in my case is:

/usr/include/boost/icl/interval_bounds.hpp:45:74: runtime error: left shift of negative value -3

comment:2 by gson@…, 5 years ago

I'm also having this problem. Here's a complete program to reproduce it:

#include <stdint.h>
#include <boost/icl/interval_set.hpp>
int main(int, char **) {
    boost::icl::interval_set<int> a;
    a.insert(boost::icl::interval<int>::right_open(-100, 100));
    a.insert(-50);
}

Building and running:

$ g++ -fsanitize=undefined test.cc -o test
$ ./test
/usr/include/boost/icl/interval_bounds.hpp:45:74: runtime error: left shift of negative value -4

This is on Debian 9.

Note: See TracTickets for help on using tickets.