This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Implement LWG3464(istream::gcount() can overflow)
ClosedPublic

Authored by yronglin on Aug 24 2023, 9:22 AM.

Diff Detail

Event Timeline

yronglin created this revision.Aug 24 2023, 9:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2023, 9:22 AM
yronglin requested review of this revision.Aug 24 2023, 9:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2023, 9:22 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
yronglin edited the summary of this revision. (Show Details)Aug 24 2023, 9:23 AM
yronglin added reviewers: ldionne, Mordante.

I'm so sorry that I have no idea how to test stream size overflow in this change now.

yronglin retitled this revision from [libc++] Implement LWG3464(istream::gcount() can overflow) to [WIP][libc++] Implement LWG3464(istream::gcount() can overflow).Aug 24 2023, 10:54 AM

I'm so sorry that I have no idea how to test stream size overflow in this change now.

I also see no good way to test this.

libcxx/include/istream
215

This is a new function, so no need to change the behaviour after V1.

215

Why is this function protected and not private?

yronglin updated this revision to Diff 553696.Aug 25 2023, 8:25 PM

Addres comments.

Mordante added inline comments.Aug 26 2023, 3:16 AM
libcxx/include/istream
225

Please use my suggestion, that matches our latest coding standard.

Nit: I prefer to have private, protected, public in that order, especially since there is already a private section.

yronglin updated this revision to Diff 553717.Aug 26 2023, 3:31 AM

Address comments.

yronglin retitled this revision from [WIP][libc++] Implement LWG3464(istream::gcount() can overflow) to [libc++] Implement LWG3464(istream::gcount() can overflow).Aug 26 2023, 3:31 AM
yronglin marked 3 inline comments as done.

Many thanks for your review! @Mordante

libcxx/include/istream
225

Sorry, somehow I have missed this comments.

This revision is now accepted and ready to land.Aug 26 2023, 10:43 AM
philnik requested changes to this revision.Aug 26 2023, 7:42 PM
philnik added a subscriber: philnik.

Shouldn't this be possible to actually test? If not, please add a comment why this change was done.

This revision now requires changes to proceed.Aug 26 2023, 7:42 PM
This revision was not accepted when it landed; it landed in state Needs Revision.Aug 26 2023, 8:25 PM
This revision was automatically updated to reflect the committed changes.
yronglin marked an inline comment as done.
yronglin added a comment.EditedAug 26 2023, 10:30 PM

Shouldn't this be possible to actually test? If not, please add a comment why this change was done.

Sorry, It may be because I didn't refresh the browser page, so I didn't see the status change to Request change. I apologize for that. I'll revert this change to resolve your concerns. I have no idea that how to test this, can you please give some guide? many thanks!

yronglin reopened this revision.Aug 26 2023, 10:36 PM

I have reverted this patch and reopen.

Shouldn't this be possible to actually test? If not, please add a comment why this change was done.

Do you have a suggestion how to test this. It depends on overflowing streamsize. This is an alias of ptrdiff_t.

Shouldn't this be possible to actually test? If not, please add a comment why this change was done.

Sorry, It may be because I didn't refresh the browser page, so I didn't see the status change to Request change. I apologize for that. I'll revert this change to resolve your concerns. I have no idea that how to test this, can you please give some guide? many thanks!

For the future it's possible to address these comments after landing the patch. It was not really needed to revert it. But now let's land if after @philnik is happy.

philnik accepted this revision.Aug 28 2023, 10:57 AM

Shouldn't this be possible to actually test? If not, please add a comment why this change was done.

Do you have a suggestion how to test this. It depends on overflowing streamsize. This is an alias of ptrdiff_t.

Ah sorry, I missed that. I though it depends the char traits. In that case I'm happy with a short explanation in the commit message. Sorry for the churn.

LGTM with a comment in the commit message.

This revision is now accepted and ready to land.Aug 28 2023, 10:57 AM

Thanks for your review! @Mordante @philnik