From 5181fc8a8dc734b44cfd79458c8a7d26f8d58d1e Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Tue, 25 Sep 2007 15:36:31 +0000 Subject: [PATCH] - fix integer underflow in compute_hash (#302181) - fix SLang_set_error when called from signal handler (#297661) --- slang-2.1.2-hashborder.patch | 12 ++++++ slang-2.1.2-slerr.patch | 77 ++++++++++++++++++++++++++++++++++++ slang.spec | 10 ++++- 3 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 slang-2.1.2-hashborder.patch create mode 100644 slang-2.1.2-slerr.patch diff --git a/slang-2.1.2-hashborder.patch b/slang-2.1.2-hashborder.patch new file mode 100644 index 0000000..2c24934 --- /dev/null +++ b/slang-2.1.2-hashborder.patch @@ -0,0 +1,12 @@ +diff -up slang-2.1.2/src/slsmg.c.hashborder slang-2.1.2/src/slsmg.c +--- slang-2.1.2/src/slsmg.c.hashborder 2007-09-17 19:17:24.000000000 +0200 ++++ slang-2.1.2/src/slsmg.c 2007-09-24 17:23:29.000000000 +0200 +@@ -993,7 +993,7 @@ static unsigned long compute_hash (SLsmg + + c += SLsmg_Scroll_Hash_Border; + csave = c; +- cmax = c + (n - SLsmg_Scroll_Hash_Border); ++ cmax = c + ((int)n - SLsmg_Scroll_Hash_Border); + + while ((c < cmax) && is_blank) + { diff --git a/slang-2.1.2-slerr.patch b/slang-2.1.2-slerr.patch new file mode 100644 index 0000000..ed32a82 --- /dev/null +++ b/slang-2.1.2-slerr.patch @@ -0,0 +1,77 @@ +Index: slang/src/slerr.c +=================================================================== +--- slang/src/slerr.c (revision 199) ++++ slang/src/slerr.c (revision 200) +@@ -384,6 +384,8 @@ + } + Error_Message_Type; + ++static char *Static_Error_Message = NULL; ++ + struct _pSLerr_Error_Queue_Type + { + Error_Message_Type *head; +@@ -531,12 +533,11 @@ + + free_queued_messages (q); + } +-#if 0 +- if (_pSLang_Error != SL_Usage_Error) ++ if (Static_Error_Message != NULL) + { +- print_error (_SLERR_MSG_ERROR, SLerr_strerror (_pSLang_Error)); ++ print_error (_SLERR_MSG_ERROR, Static_Error_Message); ++ Static_Error_Message = NULL; + } +-#endif + } + + /* This function returns a pointer to the first error message in the queue. +@@ -615,6 +616,7 @@ + + void _pSLerr_free_queued_messages (void) + { ++ Static_Error_Message = NULL; + free_queued_messages (Active_Error_Queue); + } + +@@ -626,7 +628,10 @@ + */ + if ((error == 0) + || (_pSLang_Error == 0)) +- _pSLang_Error = error; ++ { ++ Static_Error_Message = NULL; ++ _pSLang_Error = error; ++ } + + if (_pSLinterpreter_Error_Hook != NULL) + (*_pSLinterpreter_Error_Hook) (_pSLang_Error); +@@ -707,9 +712,19 @@ + { + set_error (error); + +- if (_pSLang_Error == 0) ++ if (error == 0) + return 0; + ++ if (error == SL_UserBreak_Error) ++ { ++ /* This function may be called from a SIGINT handler, in which case the ++ * error code will be SL_Usage_Error. ++ */ ++ /* print_error (_SLERR_MSG_ERROR, SLerr_strerror (_pSLang_Error)); */ ++ Static_Error_Message = SLerr_strerror (error); ++ return 0; ++ } ++ + /* If a string is not in the message queue, then add one. */ + if (Active_Error_Queue != NULL) + { +@@ -806,5 +821,6 @@ + Suspend_Error_Messages = 0; + Default_Error_Queue = NULL; + Active_Error_Queue = NULL; ++ Static_Error_Message = NULL; + } + diff --git a/slang.spec b/slang.spec index 926d01a..669875a 100644 --- a/slang.spec +++ b/slang.spec @@ -1,13 +1,15 @@ Summary: The shared library for the S-Lang extension language Name: slang Version: 2.1.2 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: System Environment/Libraries Source: ftp://space.mit.edu/pub/davis/slang/v2.1/%{name}-%{version}.tar.bz2 Patch1: slang-2.1.2-makefile.patch Patch2: slang-nointerlibc2.patch Patch3: slang-LANG.patch +Patch4: slang-2.1.2-hashborder.patch +Patch5: slang-2.1.2-slerr.patch URL: http://www.jedsoft.org/slang/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: libpng-devel pcre-devel gawk @@ -60,6 +62,8 @@ language. %patch1 -p1 -b .makefile %patch2 -p1 -b .nointerlibc2 %patch3 -p1 -b .LANG +%patch4 -p1 -b .hashborder +%patch5 -p1 -b .slerr %build %configure --includedir=%{_includedir}/slang @@ -103,6 +107,10 @@ rm -rf ${RPM_BUILD_ROOT} %{_libdir}/libslang*.a %changelog +* Tue Sep 25 2007 Miroslav Lichvar - 2.1.2-2 +- fix integer underflow in compute_hash (#302181) +- fix SLang_set_error when called from signal handler (#297661) + * Mon Sep 17 2007 Miroslav Lichvar - 2.1.2-1 - update to 2.1.2