From 862ed2b7ace176a919ed7b3a49fe5e01a5744992 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 29 Jul 2026 13:44:22 +0100 Subject: [PATCH] oracleobjectstorage: fix crash when downloading objects with unknown length - fixes #9694 Object.Open dereferenced the response's ContentLength pointer without checking it. The OCI SDK leaves ContentLength nil when the server replies without a Content-Length header or ContentRange which caused a nil pointer panic. Now the size is only updated when the response actually provides one, leaving the size from the object metadata in place otherwise. This also fixes the same potential problem in the newObject code. --- backend/oracleobjectstorage/object.go | 6 +++++- backend/oracleobjectstorage/oracleobjectstorage.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/backend/oracleobjectstorage/object.go b/backend/oracleobjectstorage/object.go index d9cc20f84..74591c56c 100644 --- a/backend/oracleobjectstorage/object.go +++ b/backend/oracleobjectstorage/object.go @@ -362,7 +362,11 @@ func (o *Object) Open(ctx context.Context, options ...fs.OpenOption) (io.ReadClo if err != nil { return nil, err } - o.bytes = *bytes + if bytes != nil { + o.bytes = *bytes + } else { + fs.Debugf(o, "Failed to find object length") + } return resp.HTTPResponse().Body, nil } diff --git a/backend/oracleobjectstorage/oracleobjectstorage.go b/backend/oracleobjectstorage/oracleobjectstorage.go index 9e27e997f..fca03bbe9 100644 --- a/backend/oracleobjectstorage/oracleobjectstorage.go +++ b/backend/oracleobjectstorage/oracleobjectstorage.go @@ -516,7 +516,11 @@ func (f *Fs) newObjectWithInfo(ctx context.Context, remote string, info *objects o.md5 = md5 } } - o.bytes = *info.Size + if info.Size != nil { + o.bytes = *info.Size + } else { + fs.Debugf(o, "Failed to find object length") + } o.storageTier = storageTierMap[strings.ToLower(string(info.StorageTier))] } else { err := o.readMetaData(ctx) // reads info and headers, returning an error