Index: src/client/mac/handler/minidump_generator.cc |
diff --git a/src/client/mac/handler/minidump_generator.cc b/src/client/mac/handler/minidump_generator.cc |
index 7d6e81dbb86439110b3106fffe9f31b7f2c70350..4ef214fe1ed0a273ee34400c5181063d3f35b760 100644 |
--- a/src/client/mac/handler/minidump_generator.cc |
+++ b/src/client/mac/handler/minidump_generator.cc |
@@ -142,15 +142,28 @@ void MinidumpGenerator::GatherSystemInformation() { |
CFRelease(read_stream); |
return; |
} |
- CFDataRef data = NULL; |
- CFIndex num_bytes_read = 0; |
- const UInt8 *data_bytes = |
- CFReadStreamGetBuffer(read_stream, 0, &num_bytes_read); |
- if (data_bytes) { |
- data = CFDataCreate(NULL, data_bytes, num_bytes_read); |
+ // Actual data file tests: Mac at 480 bytes and iOS at 413 bytes. |
+ const CFIndex kMaxBufferLength = 1024; |
+ UInt8 data_bytes[kMaxBufferLength]; |
+ CFMutableDataRef data = NULL; |
Mark Mentovai
2016/01/31 02:12:05
There is a logic problem.
|
+ CFIndex num_bytes_read = |
+ CFReadStreamRead(read_stream, data_bytes, kMaxBufferLength); |
Mark Mentovai
2016/01/31 02:12:05
Say that this reads some data and returns a positi
|
+ while (num_bytes_read > 0) { |
+ if (data == NULL) { |
+ data = CFDataCreateMutable(NULL, 0); |
+ } |
+ CFDataAppendBytes(data, data_bytes, num_bytes_read); |
+ if (num_bytes_read < kMaxBufferLength) break; |
Mark Mentovai
2016/01/29 14:40:11
seh wrote:
Mark Mentovai
2016/01/31 02:12:05
…but the positive number is less than kMaxBufferLe
Mark Mentovai
2016/01/31 02:12:05
…then you’ll break out here…
|
+ |
+ num_bytes_read = |
+ CFReadStreamRead(read_stream, data_bytes, kMaxBufferLength); |
Mark Mentovai
2016/01/31 02:12:05
…without ever trying to read more…
|
} |
CFReadStreamClose(read_stream); |
CFRelease(read_stream); |
+ if (num_bytes_read < 0) { |
+ CFRelease(data); |
+ return; |
+ } |
if (!data) { |
return; |
} |