Commit dea9b663 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Fix for NULL pointer access reporting monitor name

PipeFS was carefully preserving R6 (the special field pointer, which is 0 for PipeFS) in the places where FileSwitch expects to get the leafname back when *OPT1,2 is enabled, resulting in a NULL pointer dereference in FileSwitch. Update R6 per the spec.
Delete old switch justreturnextent from version 0.06.
Delete unused Help & Syntax, these are now in Resources/UK.

Version 0.23. Tagged as 'PipeFS-0_23'
parent d3452baf
00:*PipeCopy copies file one byte at a time Syntax: *PipeCopy <inputfile> <outputfile> [<outputfile>]
00:Syntax: *PipeCopy <inputfile> <outputfile> [<outputfile>]
;
; This file is automatically maintained by srccommit, do not edit manually.
; Last processed by srccommit version: 1.1.
;
GBLS Module_MajorVersion
GBLA Module_Version
GBLS Module_MinorVersion
GBLS Module_Date
GBLS Module_FullVersion
GBLS Module_ApplicationDate2
GBLS Module_ApplicationDate4
GBLS Module_ApplicationDate
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.22"
Module_Version SETA 22
Module_MajorVersion SETS "0.23"
Module_Version SETA 23
Module_MinorVersion SETS ""
Module_Date SETS "14 May 2001"
Module_ApplicationDate2 SETS "14-May-01"
Module_ApplicationDate4 SETS "14-May-2001"
Module_Date SETS "18 Aug 2016"
Module_ApplicationDate SETS "18-Aug-16"
Module_ComponentName SETS "PipeFS"
Module_ComponentPath SETS "RiscOS/Sources/FileSys/PipeFS"
Module_FullVersion SETS "0.22"
Module_HelpVersion SETS "0.22 (14 May 2001)"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/PipeFS"
Module_FullVersion SETS "0.23"
Module_HelpVersion SETS "0.23 (18 Aug 2016)"
END
/* (0.22)
/* (0.23)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.22
#define Module_MajorVersion_CMHG 0.23
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 14 May 2001
#define Module_Date_CMHG 18 Aug 2016
#define Module_MajorVersion "0.22"
#define Module_Version 22
#define Module_MajorVersion "0.23"
#define Module_Version 23
#define Module_MinorVersion ""
#define Module_Date "14 May 2001"
#define Module_Date "18 Aug 2016"
#define Module_ApplicationDate2 "14-May-01"
#define Module_ApplicationDate4 "14-May-2001"
#define Module_ApplicationDate "18-Aug-16"
#define Module_ComponentName "PipeFS"
#define Module_ComponentPath "RiscOS/Sources/FileSys/PipeFS"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/PipeFS"
#define Module_FullVersion "0.22"
#define Module_HelpVersion "0.22 (14 May 2001)"
#define Module_FullVersion "0.23"
#define Module_HelpVersion "0.23 (18 Aug 2016)"
#define Module_LibraryVersionInfo "0:23"
......@@ -79,9 +79,6 @@ debugda SETL debug :LAND: {FALSE}
debugxx SETL debug :LAND: {FALSE}
hostvdu SETL {FALSE} ; set to true to use TML (HostFS) output
GBLL justreturnextent
justreturnextent SETL Module_Version = 6 ; removed in version 0.07
; 22-Jan-2001 (ADH)
;
; Set dynamicareas to true to always use a dynamic area for the file heap
......@@ -687,7 +684,8 @@ PipeFS_OSFile EntryS "R1,R7,R9"
ASSERT PipeFile_Load = 0
LDMVCIA r7, {r2-r5} ; get file info
ADDVC r6, r7, #PipeFile_Name
BLVC getleafname ; for *OPT 1,1
EXIT
......@@ -736,9 +734,10 @@ PipeFS_OSFile EntryS "R1,R7,R9"
BL PipeFS_Close
MOVVC r0, r5
RestPSR r6, VC
BLVC getleafname ; for *OPT 1,1
95
Pull "r2-r5"
ADDVC r6, r7, #PipeFile_Name ; for *OPT 1,1
EXIT
......@@ -758,9 +757,6 @@ PipeFS_OSFile EntryS "R1,R7,R9"
Push "r6"
BL FindFileOrDirectory
Pull "r6"
[ justreturnextent
EXIT
|
EXIT VS
CMP r0, #object_file ; if file found, wait for it to close for writing
......@@ -770,7 +766,6 @@ PipeFS_OSFile EntryS "R1,R7,R9"
EXIT VS ; since it will never be unblocked
EXIT EQ
B %b20 ; file still open
]
; read file info without length
; in: R1 -> wildcarded filename
......@@ -815,7 +810,7 @@ PipeFS_OSFile EntryS "R1,R7,R9"
; out: R6 -> filename
40
Push "R1-R6"
Push "R1-R5"
BL getpipe ; R1 -> file header
BVS %FT41
......@@ -848,8 +843,11 @@ PipeFS_OSFile EntryS "R1,R7,R9"
STMVCIA r1, {r2,r3}
SUBVC r2, r5, r4 ; r2 = new size to ensure
BLVC try_ensuresize
MOVVC r7, r1
BLVC getleafname ; for *OPT 1,1
41
Pull "R1-R6"
Pull "R1-R5"
EXIT
......@@ -860,8 +858,6 @@ PipeFS_OSFile EntryS "R1,R7,R9"
; NE => file was open for writing, and we blocked
; VS => blocking not possible - r0 -> error
[ :LNOT: justreturnextent ; don't bother with this stuff if doing it the simple way!
blockifwriting Entry "r1"
LDR r14, [r1, #PipeFile_lenblocked]!
......@@ -878,7 +874,6 @@ blockifwriting Entry "r1"
MOVEQ r1, #0
BLEQ CopyError
EXIT
]
; *****************************************************************************
;
......@@ -1627,11 +1622,9 @@ put_loop
BLNE modifyingpipe
EXITS NE
[ :LNOT: justreturnextent
LDR r14, [r1, #PipeFile_usage] ; don't block if the other end
TST r14, #nowriteblock ; is trying to determine file size
BNE tryextend
]
MOV r14, #0
STR r14, [r1, #PipeFile_writeblocked]! ; 0 => blocked on write
......@@ -1822,11 +1815,6 @@ args_readsize ; actually reads space allocated to file
args_readext ; read size of file
Push "r1,lr"
[ justreturnextent
BIC r1, r1, #pipehandle_bits
LDR r2, [r1, #PipeFile_Ext] ; number of bytes written to file
Pull "r1,pc"
|
TST r1, #pipehandle_write
BIC r1, r1, #pipehandle_bits
LDRNE r2, [r1, #PipeFile_Ext] ; number of bytes written to file
......@@ -1847,7 +1835,6 @@ args_readext ; read size of file
ORREQ r14, r14, #nowriteblock ; we want to know how big the file is
STREQ r14, [r1, #PipeFile_usage] ; - so we must let it all be read in
B %b11
]
args_readptr ; read size of file
Push "r1,lr"
......@@ -2109,6 +2096,26 @@ skipdollar Entry
EXIT
; *****************************************************************************
;
; in: R7 -> file header
; out: R6 -> leafname for monitor
; V preserved
;
getleafname Entry "r7"
ADD R7, R7, #PipeFile_Name
MOV R6, R7 ; In case there are no dots
10
LDRB R14, [R7], #1
TEQ R14, #'.'
MOVEQ R6, R7 ; Leaf starting after most recent dot
TEQ R14, #0
BNE %BT10
EXIT
; *****************************************************************************
;
; In : R0 is wildcard spec ptr, R4 is name ptr.
......
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