Opened 12 years ago

Last modified 11 years ago

#4772 reopened Bugs

binary_buffer_iprimitive fails on vector access when reading in zero length item at end of buffer_

Reported by: Jeff Jackowski <jeff.jackowski@…> Owned by: Matthias Troyer
Milestone: Boost 1.46.0 Component: mpi
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc:

Description

When binary_buffer_iprimitive's position == buffer_.size() and binary_buffer_iprimitive::load_impl is called with l = 0, the bracket operator on buffer_ will attempt an out of bounds access. The assertion in load_impl suggests the author was aware these conditions are normal since the assertion evaluates to true. However, the parameters for the call to std::memcpy cannot be evaluated because an assertion within buffer_ fails. Changing load_impl to look like this fixes the problem:

void load_impl(void * p, int l) {

assert(position+l<=static_cast<int>(buffer_.size())); if (l) {

std::memcpy(p,&buffer_[position],l); position += l;

}

}

It looks like the bug should also exist in Boost's trunk, but I cannot get the software I'm working on to build with Boost 1.44 and newer, but that is another issue.

Change History (4)

comment:1 by Matthias Troyer, 12 years ago

Owner: changed from Douglas Gregor to Matthias Troyer
Status: newassigned

comment:2 by Matthias Troyer, 12 years ago

Milestone: To Be DeterminedBoost-1.46.0

comment:3 by Matthias Troyer, 12 years ago

Resolution: fixed
Status: assignedclosed

Fixed in changeset [66785]

comment:4 by brian.ventre@…, 11 years ago

Resolution: fixed
Status: closedreopened
Version: Boost 1.43.0Boost 1.47.0

Bug is fixed in SVN trunk, but not in 1.47.0 or 1.46.1. Will it be merged for 1.48?

Note: See TracTickets for help on using tickets.