Commit fc930421 authored by Jeffrey Lee's avatar Jeffrey Lee

Fix null pointer dereference when building floppy Format menu

Detail:
  s/ADFSFiler - The commenting out of the MOV R5,#0 line in a previous bug fix left a null pointer dereference in the code when EnumFormats_Flags is checked. Examination of the code suggests the intent was to use the MOV R5,#0 to skip the EnumFormats_Flags check, so modify the preceeding CMP to check for R5=0 or R0=0.
Admin:
  Tested in Iyonix ROM softload
  Fixes issue #436
  https://www.riscosopen.org/tracker/tickets/436


Version 1.12. Tagged as 'ADFSFiler-1_12'
parent 4f75a3b2
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.11"
Module_Version SETA 111
Module_MajorVersion SETS "1.12"
Module_Version SETA 112
Module_MinorVersion SETS ""
Module_Date SETS "20 Sep 2016"
Module_ApplicationDate SETS "20-Sep-16"
Module_Date SETS "26 Mar 2017"
Module_ApplicationDate SETS "26-Mar-17"
Module_ComponentName SETS "ADFSFiler"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/ADFS/ADFSFiler"
Module_FullVersion SETS "1.11"
Module_HelpVersion SETS "1.11 (20 Sep 2016)"
Module_FullVersion SETS "1.12"
Module_HelpVersion SETS "1.12 (26 Mar 2017)"
END
/* (1.11)
/* (1.12)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.11
#define Module_MajorVersion_CMHG 1.12
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 20 Sep 2016
#define Module_Date_CMHG 26 Mar 2017
#define Module_MajorVersion "1.11"
#define Module_Version 111
#define Module_MajorVersion "1.12"
#define Module_Version 112
#define Module_MinorVersion ""
#define Module_Date "20 Sep 2016"
#define Module_Date "26 Mar 2017"
#define Module_ApplicationDate "20-Sep-16"
#define Module_ApplicationDate "26-Mar-17"
#define Module_ComponentName "ADFSFiler"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/ADFS/ADFSFiler"
#define Module_FullVersion "1.11"
#define Module_HelpVersion "1.11 (20 Sep 2016)"
#define Module_LibraryVersionInfo "1:11"
#define Module_FullVersion "1.12"
#define Module_HelpVersion "1.12 (26 Mar 2017)"
#define Module_LibraryVersionInfo "1:12"
......@@ -4088,9 +4088,10 @@ BuildFormatMenu ROUT
; If longer than longest so far, update menu header
MOV R14,R1,ASL #4 ; *16
ADD R14,R14,#16 ; +16 = Half a char at each end in OS Units
CMP r5,#0
CMP r5,#0 ; r5=0 if this is the "Current format" entry
CMPNE r0,#0 ; r0=0 if this is the "Other formats" entry
BEQ %FT80
LDR R9,[r0,#EnumFormats_Flags]
LDR R9,[r0,#EnumFormats_Flags] ; Else it must be a format entry, so check which menu it's going in
TST R9,#EnumFormats_IsNative
BEQ %FT81
80
......@@ -4119,6 +4120,7 @@ NextItem
CMP r0,#0
BNE %BT01
; Add the "Other formats" entry
; OSS is_shaded
MOV R1,#mi_it_lastitem ; Menu flags.
......@@ -4141,16 +4143,14 @@ NextItem
ADR r2,OtherFormatsText
MOV r3,#OtherFormatsTextLength
SWI XMessageTrans_Lookup
ADDVS SP,SP,#9 *4 ;r0-r4, r0;
ADDVS SP,SP,#9 *4 ;r0-r7, r0;
Pull "r0-r7",VC
Pull "r1-r6,r11,PC",VS
ADR r9,OtherFormatsText
STR r9,[r3],#4
MOV r1,r9
MOV r2,r3
; ECN - This seems to 0 the menu width for some reason
; MOV r5,#0 ; <<<<< ************************************** ??????????????????
B %BT02 ; Don't zap menu width !
B %BT02 ; Go back around to update menu width
03
; Mark last item as such
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment