lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue 4212: fix out-of-bounds index in division_maior() (issue 18942


From: nine . fierce . ballads
Subject: Re: Issue 4212: fix out-of-bounds index in division_maior() (issue 189420043 by address@hidden)
Date: Fri, 02 Jan 2015 14:16:53 +0000

On 2015/01/02 08:56:03, dak wrote:
In particular, the compiler is allowed to make
line_pos.begin () < whatever the same as line_pos.begin () !=
whatever.

* std::vector elements must be contiguous after C++03
(http://en.cppreference.com/w/cpp/container/vector)
* it[n] is convertible to a reference and is equivalent to *(i + n)
(http://en.cppreference.com/w/cpp/concept/RandomAccessIterator)

Therefore there should be no problem with "x.begin() < it" as long as
the vector is not empty and "it != x.end()".  I'm not sure if anything
constrains the implementation of x.end() to refer to the place this code
assumes it does, so that might still be a problem.

Still, I'm going to resist doing anything other than fixing the
immediate problem.  I do not want to risk spending a bunch of time
debugging if I rewrite it wrong.


https://codereview.appspot.com/189420043/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]