Opened 12 years ago

Closed 12 years ago

#4841 closed defect (fixed)

struct AD should be deep copied

Reported by: Erik Hovland <erik@…> Owned by: Isaac Richards
Priority: minor Milestone: 0.22
Component: mythtv Version: 0.21-fixes
Severity: low Keywords:
Cc: Ticket locked: no

Description

In UDFMapICB the code makes a copy of a struct by doing a

      *File = tmpmap.file;

And again:

tmpmap.file = *File;

C++ compilers will likely do the right thing. And even GNU gcc might do the right thing. But it is also possible that the copy won't happen right. In this case, if it got it wrong, then the Partition member of the struct could never get modified throughout the function and then it will be taken as fact that it was and used by this functions callers.

Attachments (1)

libs_libmythdvdnav_dvd_udf.c-deep-copy-ads.patch (1.6 KB) - added by Erik Hovland <erik@…> 12 years ago.
Does a deep copy of AD structs in UDFMapICB(), note - it is likely that a memcpy could be done too. I didn't to highlight my point. But it may be more efficient.

Download all attachments as: .zip

Change History (3)

Changed 12 years ago by Erik Hovland <erik@…>

Does a deep copy of AD structs in UDFMapICB(), note - it is likely that a memcpy could be done too. I didn't to highlight my point. But it may be more efficient.

comment:1 Changed 12 years ago by Isaac Richards

Milestone: 0.210.22

comment:2 Changed 12 years ago by danielk

Resolution: fixed
Status: newclosed

(In [17208]) Fixes #4841. This one is pretty trivial; some C compilers don't support structure assignment, but all modern ANSI C compilers do; this avoids the structure copy just to be extra safe.

Note: See TracTickets for help on using tickets.