HomePhabricator

libcxx: Fix for basic_stringbuf::seekoff() after r320604.

Description

libcxx: Fix for basic_stringbuf::seekoff() after r320604.

As a result of this change, the basic_stringbuf constructor that
takes a mode ends up leaving hm_ set to 0, causing the comparison
"
hm_ - str_.data() < noff" in seekoff() to succeed, which caused
the function to incorrectly return -1. The fix is to account for the
possibility of hm_ being 0 when computing the distance from hm_
to the start of the string.

Differential Revision: https://reviews.llvm.org/D41319

Details