Fix infinite loop in Cursor::readTerminatedString
authorAlan Frindell <afrind@fb.com>
Thu, 22 Oct 2015 20:12:58 +0000 (13:12 -0700)
committerfacebook-github-bot-4 <folly-bot@fb.com>
Thu, 22 Oct 2015 21:20:20 +0000 (14:20 -0700)
commit69f3c942bea36d07e832af38e3aa36c326491c30
treeae8aa16b1703a435721f082491e27c9c62480f13
parentd1027eb286433b5726e6778ee3a7ed85e4ca23d0
Fix infinite loop in Cursor::readTerminatedString

Summary: readTerminatedString could infinite loop if the terminator does not appear in the contained IOBuf chain and maxLength > chain.computeChainLength.  I'm throwing out_of_range here because that more closely mirrors what the other read() functions do.

Reviewed By: siyengar

Differential Revision: D2571039

fb-gh-sync-id: 1db22089562d8767920d66a0a1b091b02de6571f
folly/io/Cursor.h
folly/io/test/IOBufCursorTest.cpp