Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: src/client/mac/handler/minidump_generator.cc

Issue 1637433003: Remove use of deprecated CFURLCreateDataAndPropertiesFromResource function. (Closed) Base URL: https://chromium.googlesource.com/breakpad/breakpad.git@master
Patch Set: Remove whitespace. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698