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: benko . pal
Subject: Re: Issue 4212: fix out-of-bounds index in division_maior() (issue 189420043 by address@hidden)
Date: Fri, 02 Jan 2015 11:53:29 +0000

On 2015/01/02 08:56:03, dak wrote:
On 2015/01/02 07:21:19, benko.pal wrote:
> On 2015/01/01 23:08:56, Dan Eble wrote:
> > On 2015/01/01 22:57:31, benko.pal wrote:
> > >
https://codereview.appspot.com/189420043/diff/1/lily/breathing-sign.cc
> > > File lily/breathing-sign.cc (right):
> > >
> > >
> >
>

https://codereview.appspot.com/189420043/diff/1/lily/breathing-sign.cc#newcode122
> lily/breathing-sign.cc:122: if (ydim[DOWN] < val && line_pos.begin
() < it - 1)
> I'd rather write
> line_pos.begin () + 1 < it
> but good catch anyway, thanks!

Actually, all of those checks (existing and proposed) look like
undefined
behavior since they calculate a possibly non-existing iterator and
compare with
it.  With most compilers and implementations things will probably
work, but one
can't really rely on it.  In particular, the compiler is allowed to
make
line_pos.begin () < whatever the same as line_pos.begin () !=
whatever.

it - 1 was used above as it[-1]; it exists, because ydim is a positive
range
(last if) strictly smaller than the whole staff (widening by negative
amount),
so it must be larger than begin, as asserted.

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



reply via email to

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