Skip to content

Commit

Permalink
Avoid segfault when text_left or text_right uses non supported chars.
Browse files Browse the repository at this point in the history
  • Loading branch information
sackmotion committed Jan 24, 2012
1 parent fcdd331 commit 97ade56
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Bugfixes
* Fixed configure for SDL.
* Replace malloc() by calloc(). (Jeroen Massar)
* Free file descriptor buffers on exit.
* Avoid segfault when text_left or text_right uses non supported chars.

3.2.12 Summary of Changes

Expand Down
18 changes: 9 additions & 9 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.67 for motion Git-05b815771a359a3a66c1c06a597cb6b947fefe89.
# Generated by GNU Autoconf 2.67 for motion Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
Expand Down Expand Up @@ -549,8 +549,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='motion'
PACKAGE_TARNAME='motion'
PACKAGE_VERSION='Git-05b815771a359a3a66c1c06a597cb6b947fefe89'
PACKAGE_STRING='motion Git-05b815771a359a3a66c1c06a597cb6b947fefe89'
PACKAGE_VERSION='Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7'
PACKAGE_STRING='motion Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Expand Down Expand Up @@ -1217,7 +1217,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures motion Git-05b815771a359a3a66c1c06a597cb6b947fefe89 to adapt to many kinds of systems.
\`configure' configures motion Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1278,7 +1278,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of motion Git-05b815771a359a3a66c1c06a597cb6b947fefe89:";;
short | recursive ) echo "Configuration of motion Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1424,7 +1424,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
motion configure Git-05b815771a359a3a66c1c06a597cb6b947fefe89
motion configure Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7
generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc.
Expand Down Expand Up @@ -2021,7 +2021,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by motion $as_me Git-05b815771a359a3a66c1c06a597cb6b947fefe89, which was
It was created by motion $as_me Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7, which was
generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@
Expand Down Expand Up @@ -6531,7 +6531,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by motion $as_me Git-05b815771a359a3a66c1c06a597cb6b947fefe89, which was
This file was extended by motion $as_me Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7, which was
generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -6593,7 +6593,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
motion config.status Git-05b815771a359a3a66c1c06a597cb6b947fefe89
motion config.status Git-fcdd33103646f13db62d7c1d97040ea6e78ba7a7
configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\"
Expand Down
11 changes: 10 additions & 1 deletion draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1097,10 +1097,19 @@ static int draw_textn(unsigned char *image, unsigned int startx, unsigned int st
char_arr_ptr = factor ? big_char_arr_ptr : small_char_arr_ptr;

for (pos = 0; pos < len; pos++) {
char_ptr = char_arr_ptr[(int)text[pos]];
int pos_check = (int)text[pos];

char_ptr = char_arr_ptr[pos_check];

for (y = 8 * (factor + 1); y--;) {
for (x = 7 * (factor + 1); x--;) {

if (pos_check < 0) {
image_ptr++;
char_ptr++;
continue;
}

switch(*char_ptr) {
case 1:
*image_ptr = 0;
Expand Down

0 comments on commit 97ade56

Please sign in to comment.