| 761 | |
| 762 | template<typename Stream, unsigned int N, typename T> |
| 763 | void Unserialize_impl(Stream& is, prevector<N, T>& v, const unsigned char&) |
| 764 | { |
| 765 | // Limit size per read so bogus size value won't cause out of memory |
| 766 | v.clear(); |
| 767 | unsigned int nSize = ReadCompactSize(is); |
| 768 | unsigned int i = 0; |
| 769 | while (i < nSize) |
| 770 | { |
| 771 | unsigned int blk = std::min(nSize - i, (unsigned int)(1 + 4999999 / sizeof(T))); |
| 772 | v.resize_uninitialized(i + blk); |
| 773 | is.read(AsWritableBytes(Span{&v[i], blk})); |
| 774 | i += blk; |
| 775 | } |
| 776 | } |
| 777 | |
| 778 | template<typename Stream, unsigned int N, typename T, typename V> |
| 779 | void Unserialize_impl(Stream& is, prevector<N, T>& v, const V&) |
no test coverage detected