Loading...
--- xnu/xnu-8019.41.5/libkern/c++/OSSerializeBinary.cpp
+++ xnu/xnu-8792.61.2/libkern/c++/OSSerializeBinary.cpp
@@ -129,7 +129,7 @@
headerSize += sizeof(uint32_t);
}
offset /= sizeof(uint32_t);
- indexData->appendBytes(&offset, sizeof(offset));
+ indexData->appendValue(offset);
}
if (os_add3_overflow(size, headerSize, 3, &alignSize)) {
@@ -218,7 +218,7 @@
OSBoolean * boo;
unsigned int tagIdx;
- uint32_t i, key, startCollection;
+ uint32_t i, key, startCollection = 0;
uint32_t len;
bool ok;
@@ -328,25 +328,15 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#define setAtIndex(v, idx, o) \
- if (idx >= v##Capacity) \
- { \
- if (v##Capacity >= v##CapacityMax) ok = false; \
- else \
- { \
+ ok = idx < v##Capacity; \
+ if (!ok && v##Capacity < v##CapacityMax) { \
uint32_t ncap = v##Capacity + 64; \
- typeof(v##Array) nbuf = kalloc_type_tag_bt(OSObject *, ncap, \
- Z_WAITOK_ZERO, VM_KERN_MEMORY_LIBKERN); \
- if (!nbuf) ok = false; \
- else \
- { \
- if (v##Array) \
- { \
- bcopy(v##Array, nbuf, v##Capacity * sizeof(o)); \
- kfree_type(OSObject *, v##Capacity, v##Array); \
- } \
+ typeof(v##Array) nbuf = kreallocp_type_container(OSObject *, \
+ v##Array, v##Capacity, &ncap, Z_WAITOK_ZERO); \
+ if (nbuf) { \
+ ok = true; \
v##Array = nbuf; \
v##Capacity = ncap; \
- } \
} \
} \
if (ok) v##Array[idx] = o