Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MachReader.Read: Don't use an iterator
MachReader.Read will read the header of the a fat mach object, and will create a MachObjectFile for each mach object in the fat mach object. It currently does so in an iterator. This reads a MachFatObject, yields control to the caller, and then reads the next MachFatObject. However, the method does assume that the state of `stream` does not change. That's not guaranteed to be the case -- a caller could write code like this: ```csharp foreach(var mach in Read(stream)) { // Read data from the mach object, which will // alter the state of `stream` } ``` To avoid this, change `MachReader.Read` to enumerate all architectures, create `MachObjectFile` objects, and only then yield control to the caller.
- Loading branch information