projects
/
sxemacs
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a491fd4
)
Coverity: Negative RETURNS: CID 106
author
Nelson Ferreira
<nelson.ferreira@ieee.org>
Fri, 20 Jan 2012 03:42:32 +0000
(22:42 -0500)
committer
Nelson Ferreira
<nelson.ferreira@ieee.org>
Fri, 20 Jan 2012 03:42:32 +0000
(22:42 -0500)
* src/indent.c (vpix_motion): Try to handle more safely the
crashing fatally scenario...
Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/indent.c
patch
|
blob
|
history
diff --git
a/src/indent.c
b/src/indent.c
index
290386e
..
d0c303b
100644
(file)
--- 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;
}