From: Nelson Ferreira Date: Fri, 20 Jan 2012 03:42:32 +0000 (-0500) Subject: Coverity: Negative RETURNS: CID 106 X-Git-Tag: v22.1.15~43^2~10 X-Git-Url: https://cgit.sxemacs.org/?a=commitdiff_plain;h=b1295cda5c773a2cd3114928bc77d8b6a1d98fd8;p=sxemacs Coverity: Negative RETURNS: CID 106 * src/indent.c (vpix_motion): Try to handle more safely the crashing fatally scenario... Signed-off-by: Nelson Ferreira --- diff --git a/src/indent.c b/src/indent.c index 290386e..d0c303b 100644 --- a/src/indent.c +++ b/src/indent.c @@ -571,10 +571,15 @@ static int vpix_motion(line_start_cache_dynarr * cache, int start, int end) assert(start >= 0); assert(end < Dynarr_length(cache)); + if (start<0 || end<0 || end>start) { + /* Least bad thing in case of in fatal_failure, where + assert will not terminate this function... */ + return 0; + } + vpix = 0; for (i = start; i <= end; i++) vpix += Dynarr_atp(cache, i)->height; - return vpix; }