void CheckBinaryFFOutThroughBoostFilterStream() { // filtering stream fails to write 0xFF chars to ostream. Have reproduced with ofstream too std::ostringstream ostm(std::ios_base::out | std::ios_base::binary); // Use empty filtering stream. Problem was originally found with zlib_compressor boost::iostreams::filtering_ostream filterStream; filterStream.push( ostm ); const unsigned fileSize = 30000; for( unsigned nWritten = 0; nWritten < fileSize; ++nWritten) { const char eofTest = -1; // Only fails with 0xFF character any other value fine filterStream.write( &eofTest, sizeof eofTest); } filterStream.flush(); // This assert fails on Xcode. The number of missing characters is equal to the number // of times overflow got called assert( ostm.str().size() == fileSize); }