From 38fd341cb0c66b4b41f97a493846785cb323a177 Mon Sep 17 00:00:00 2001 From: Jeffrey Lee <jlee@gitlab.riscosopen.org> Date: Fri, 26 Nov 2010 18:54:53 +0000 Subject: [PATCH] Fix alignment fault when reporting the "This file doesn't contain a BASIC program" error Detail: rlib/c/txtedit - Rather than generating a proper error block to send to Wimp_ReportError, txtedit__validbasicfile was just subtracting 4 from the pointer to the error string. The resulting address isn't guaranteed to be aligned properly, resulting in an alignment fault on ARMv7 when Wimp_ReportError examines the error number. The new code just reuses the 'buff' array to build a temporary error block. Admin: Fixes alignment fault on beagleboard when attempting to load a detokenized BASIC file into !Edit. Version 5.57. Tagged as 'RISC_OSLib-5_57' --- VersionASM | 12 ++++++------ VersionNum | 20 ++++++++++---------- rlib/c/txtedit | 5 ++++- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/VersionASM b/VersionASM index 6908c89..a55383a 100644 --- a/VersionASM +++ b/VersionASM @@ -11,13 +11,13 @@ GBLS Module_HelpVersion GBLS Module_ComponentName GBLS Module_ComponentPath -Module_MajorVersion SETS "5.56" -Module_Version SETA 556 +Module_MajorVersion SETS "5.57" +Module_Version SETA 557 Module_MinorVersion SETS "" -Module_Date SETS "28 Nov 2009" -Module_ApplicationDate SETS "28-Nov-09" +Module_Date SETS "26 Nov 2010" +Module_ApplicationDate SETS "26-Nov-10" Module_ComponentName SETS "RISC_OSLib" Module_ComponentPath SETS "castle/RiscOS/Sources/Lib/RISC_OSLib" -Module_FullVersion SETS "5.56" -Module_HelpVersion SETS "5.56 (28 Nov 2009)" +Module_FullVersion SETS "5.57" +Module_HelpVersion SETS "5.57 (26 Nov 2010)" END diff --git a/VersionNum b/VersionNum index aa9097e..58225a7 100644 --- a/VersionNum +++ b/VersionNum @@ -1,23 +1,23 @@ -/* (5.56) +/* (5.57) * * This file is automatically maintained by srccommit, do not edit manually. * Last processed by srccommit version: 1.1. * */ -#define Module_MajorVersion_CMHG 5.56 +#define Module_MajorVersion_CMHG 5.57 #define Module_MinorVersion_CMHG -#define Module_Date_CMHG 28 Nov 2009 +#define Module_Date_CMHG 26 Nov 2010 -#define Module_MajorVersion "5.56" -#define Module_Version 556 +#define Module_MajorVersion "5.57" +#define Module_Version 557 #define Module_MinorVersion "" -#define Module_Date "28 Nov 2009" +#define Module_Date "26 Nov 2010" -#define Module_ApplicationDate "28-Nov-09" +#define Module_ApplicationDate "26-Nov-10" #define Module_ComponentName "RISC_OSLib" #define Module_ComponentPath "castle/RiscOS/Sources/Lib/RISC_OSLib" -#define Module_FullVersion "5.56" -#define Module_HelpVersion "5.56 (28 Nov 2009)" -#define Module_LibraryVersionInfo "5:56" +#define Module_FullVersion "5.57" +#define Module_HelpVersion "5.57 (26 Nov 2010)" +#define Module_LibraryVersionInfo "5:57" diff --git a/rlib/c/txtedit b/rlib/c/txtedit index 2448df5..8e0c593 100644 --- a/rlib/c/txtedit +++ b/rlib/c/txtedit @@ -2275,8 +2275,11 @@ static BOOL txtedit__validbasicfile(char *filename) } os_swi2(OS_Find, 0, r1); /* close the file */ if (!result) { + _kernel_oserror *e = (_kernel_oserror *) buff; /* Reuse buff since it's big enough */ + e->errnum = 0; + strcpy(e->errmess,msgs_lookup(MSGS_bas1)); r1 = _swi(Wimp_ReportError, _IN(0)|_IN(1)|_IN(2)|_RETURN(1), - msgs_lookup(MSGS_bas1) - 4, 3, wimpt_programname()); + e, 3, wimpt_programname()); if (r1 == 2) return 2; } } -- GitLab