[ROOT-5648] Error check in TKey.cxx Created: 31/Oct/13  Updated: 28/May/14  Resolved: 28/May/14

Status: Closed
Project: ROOT
Component/s: I/O
Affects Version/s: 5.34/00, 6.00.00
Fix Version/s: 6.00.00

Type: Improvement Priority: Medium
Reporter: Serguei Linev Assignee: Philippe Canal
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 15 minutes
Time Spent: Not Specified
Original Estimate: 15 minutes
Environment:

Error handling when reading ROOT files


PlannedEnd:
PlannedStart:
Bug / Feature: Suggestion
Severity: 3 - Normal
Development:

 Description   

In TKey.cxx. line 776

http://root.cern.ch/root/html/src/TKey.cxx.html#776

One could potentially make arithmetic with NULL pointer, which is not good.
I propose to check pobj before performing arithmetic.

if (!pobj)

{ Error("ReadObj", "Cannot create new object of class %s", fClassName.Data()); return 0; }

TObject* tobj = (TObject*)(pobj+baseOffset);



 Comments   
Comment by Serguei Linev [ 31/Oct/13 ]

Same problem in TKey::ReadObjWithBuffer(), line 903.

Comment by Philippe Canal [ 28/May/14 ]

Change applied.

Thanks,
Philippe.

Generated at Sat Sep 21 06:40:57 CEST 2019 using Jira 7.13.1#713001-sha1:5e06076c2d215a6f699b7e5c90ab2fae7ba5a1ce.