Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006, Google Inc. | 1 // Copyright (c) 2006, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 false); | 135 false); |
| 136 CFReadStreamRef read_stream = CFReadStreamCreateWithFile(NULL, sys_vers); | 136 CFReadStreamRef read_stream = CFReadStreamCreateWithFile(NULL, sys_vers); |
| 137 CFRelease(sys_vers); | 137 CFRelease(sys_vers); |
| 138 if (!read_stream) { | 138 if (!read_stream) { |
| 139 return; | 139 return; |
| 140 } | 140 } |
| 141 if (!CFReadStreamOpen(read_stream)) { | 141 if (!CFReadStreamOpen(read_stream)) { |
| 142 CFRelease(read_stream); | 142 CFRelease(read_stream); |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 // Actual data file tests: Mac at 480 bytes and iOS at 413 bytes, | |
| 146 // so setting max length comfortably higher. | |
| 147 const CFIndex kMaxBufferLength = 2048; | |
| 148 UInt8 data_bytes[kMaxBufferLength]; | |
| 149 CFIndex num_bytes_read = | |
| 150 CFReadStreamRead(read_stream, data_bytes, kMaxBufferLength); | |
| 145 CFDataRef data = NULL; | 151 CFDataRef data = NULL; |
| 146 CFIndex num_bytes_read = 0; | 152 if (num_bytes_read > 0) { |
|
Mark Mentovai
2016/01/26 14:08:50
If num_bytes_read == kMaxBufferLength, there may h
ivanpe
2016/01/27 18:35:42
Mark, Scott addressed your comment. Can you pleas
| |
| 147 const UInt8 *data_bytes = | |
| 148 CFReadStreamGetBuffer(read_stream, 0, &num_bytes_read); | |
| 149 if (data_bytes) { | |
| 150 data = CFDataCreate(NULL, data_bytes, num_bytes_read); | 153 data = CFDataCreate(NULL, data_bytes, num_bytes_read); |
| 151 } | 154 } |
| 152 CFReadStreamClose(read_stream); | 155 CFReadStreamClose(read_stream); |
| 153 CFRelease(read_stream); | 156 CFRelease(read_stream); |
| 154 if (!data) { | 157 if (!data) { |
| 155 return; | 158 return; |
| 156 } | 159 } |
| 157 CFDictionaryRef list = static_cast<CFDictionaryRef> | 160 CFDictionaryRef list = static_cast<CFDictionaryRef> |
| 158 (CFPropertyListCreateFromXMLData(NULL, data, kCFPropertyListImmutable, | 161 (CFPropertyListCreateFromXMLData(NULL, data, kCFPropertyListImmutable, |
| 159 NULL)); | 162 NULL)); |
| (...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1582 } else { | 1585 } else { |
| 1583 info_ptr->validity = MD_BREAKPAD_INFO_VALID_DUMP_THREAD_ID; | 1586 info_ptr->validity = MD_BREAKPAD_INFO_VALID_DUMP_THREAD_ID; |
| 1584 info_ptr->dump_thread_id = handler_thread_; | 1587 info_ptr->dump_thread_id = handler_thread_; |
| 1585 info_ptr->requesting_thread_id = 0; | 1588 info_ptr->requesting_thread_id = 0; |
| 1586 } | 1589 } |
| 1587 | 1590 |
| 1588 return true; | 1591 return true; |
| 1589 } | 1592 } |
| 1590 | 1593 |
| 1591 } // namespace google_breakpad | 1594 } // namespace google_breakpad |
| OLD | NEW |