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