mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-08 14:47:31 +02:00
44feab23a7script: Fix undefined behavior in Clone() -- std::transform writes past end of empty vector (Weixie Cui) Pull request description: # Motivation This patch fixes undefined behavior in Clone() in src/script/descriptor.cpp. When std::transform is used with providers.begin() or subdescs.begin() as the output iterator, the vectors have been reserve()d but have size 0. Writing through begin() in that case writes past the logical end of the vector, which is undefined behavior. ACKs for top commit: maflcko: lgtm ACK44feab23a7rkrux: ACK44feab23a7because it gets rid of the possible undefined behaviour. frankomosh: Code Review ACK44feab23a7. Fix seems minimal and correct. Tree-SHA512: 8af3b6d97c139b32bd47d4c452b6b16befdaa7028a7bc1b6de0ab1f0a8cb35eb068710316a2c07fa60856e17e25307931aa3125b4f41d0fe7726b435483a52db