From: Junio C Hamano Date: Sat, 16 Apr 2016 00:49:31 GMT Subject: Re: [PATCH 2/2] xdiff: implement empty line chunk heuristic Message-ID: In-Reply-To: <1460761306-18794-3-git-send-email-sbeller@google.com> Stefan Beller writes: > +static int line_length(const char *recs) > +{ > + char *s = strchr(recs, '\n'); > + return s ? s - recs : strlen(recs); > +} It seems that you guys are discarding this "number of bytes on a line, no matter what these bytes are" idea, so this may be moot, but is there a guarantee that reading through recs until you happen to see a NUL is safe? Shouldn't the code that accesses a "line" be using the same "from here to there", i.e. recs[]->ptr, recs[]->size, interface to avoid having to scan the underlying string in an unbounded way?