summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2010-03-03 11:18:55 -0500
committerSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2010-03-03 11:18:55 -0500
commitda8e87d6505fb33ed131144a33af88c6d0dc96fd (patch)
tree2ff18481123c272c71e53dd502b48acbefdb3b74
parent48624f98db28bd8c117cf1aebfc2cd326f6243bc (diff)
downloadscreen-da8e87d6505fb33ed131144a33af88c6d0dc96fd.tar.gz
Sanity check line numbers for non-negative value.
It looks like 'ys' can be negative at times, which results in invalid memory reads, and possibly writes. Valgrind log from Friedrich Delgado Friedrichs in savannah bug #29050.
-rw-r--r--src/layer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/layer.c b/src/layer.c
index 88d7360..9c1fe34 100644
--- a/src/layer.c
+++ b/src/layer.c
@@ -1285,6 +1285,8 @@ int ys, ye;
{
if (!layer->l_pause.d)
return;
+ if (ys < 0)
+ ys = 0;
if (ye >= layer->l_height)
ye = layer->l_height - 1;
if (xe >= layer->l_width)