Re: [PATCH] blame: prevent a segv when -L given start > EOF

4 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] blame: prevent a segv when -L given start > EOF

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:12

Jay Soffian [off-list ref] writes:
-	if (lno < top)
+	if (lno < top || lno < bottom)
 		die("file %s has only %lu lines", path, lno);
Thanks; I think we make sure that "bottom < top" always hold true before
we reach this point, so checking with bottom alone should suffice, no?

Re: [PATCH] blame: prevent a segv when -L given start > EOF

From: Jay Soffian <hidden>
Date: 2016-06-15 22:48:12

On Mon, Feb 8, 2010 at 10:55 PM, Junio C Hamano [off-list ref] wrote:
Jay Soffian [off-list ref] writes:
quoted
-     if (lno < top)
+     if (lno < top || lno < bottom)
              die("file %s has only %lu lines", path, lno);
Thanks; I think we make sure that "bottom < top" always hold true before
we reach this point,
We swap them if they're reversed.
so checking with bottom alone should suffice, no?
Ah true. You can squash that in? :-)

j.

Re: [PATCH] blame: prevent a segv when -L given start > EOF

From: Jay Soffian <hidden>
Date: 2016-06-15 22:48:12

On Mon, Feb 8, 2010 at 11:00 PM, Jay Soffian [off-list ref] wrote:
quoted
so checking with bottom alone should suffice, no?
Ah true. You can squash that in? :-)
Actually, no, that doesn't work, but my head can't keep bottom=start,
top=end straight so I'm not even sure why not.

j.

Re: [PATCH] blame: prevent a segv when -L given start > EOF

From: Jay Soffian <hidden>
Date: 2016-06-15 22:48:12

On Mon, Feb 8, 2010 at 10:55 PM, Junio C Hamano [off-list ref] wrote:
Jay Soffian [off-list ref] writes:
quoted
-     if (lno < top)
+     if (lno < top || lno < bottom)
              die("file %s has only %lu lines", path, lno);
Thanks; I think we make sure that "bottom < top" always hold true before
we reach this point, so checking with bottom alone should suffice, no?
Right, so given "-L 10" at the point of that check:

bottom = 0
top = 10

Whereas given "-L 10,100" at the point of that check:

bottom = 9
top = 100

So the code needs to check both.  Previously it made sure neither was
< 1, and swapped bottom/top if they were reversed.

Sorry for the confusion.

j.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help