Commit dec5ee1
Tolerate feof returning arbitrary non-zero values
feof apparently does not promise EOF returns 1, just a non-zero value.
See [0]. We very much do not care about the impacted platform, but it is
probably prudent to handle this, in case some platform we do care about
uses this leeway. While I'm here, add a test for EOF in file BIOs.
In writing this test, I noticed that BIO_reset's return value
convention, like BIO_seek, is completely inconsistent. Document the
problem for now. (OpenSSL's documentation[1] also mentions this, though
they seem to have missed that fds are also impacted.)
[0] openssl/openssl#30395
[1] https://docs.openssl.org/master/man3/BIO_ctrl/#description:~:text=%C2%B6-,BIO_reset()%20normally%20returns%201%20for%20success%20and%20%3C%3D0%20for%20failure.%20File%20BIOs%20are%20an%20exception%2C%20they%20return%200%20for%20success%20and%20%2D1%20for%20failure.,-BIO_seek()%20and%20BIO_tell
Change-Id: I2df1925b157bb34897174143d74ca9e5e86a673c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/90888
Reviewed-by: Lily Chen <chlily@google.com>
Commit-Queue: Lily Chen <chlily@google.com>
Auto-Submit: David Benjamin <davidben@google.com>1 parent d2c7ec9 commit dec5ee1
3 files changed
+43
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
707 | 738 | | |
708 | 739 | | |
709 | 740 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
150 | | - | |
| 150 | + | |
| 151 | + | |
151 | 152 | | |
152 | 153 | | |
153 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
123 | 127 | | |
124 | 128 | | |
125 | 129 | | |
| |||
496 | 500 | | |
497 | 501 | | |
498 | 502 | | |
499 | | - | |
500 | | - | |
| 503 | + | |
| 504 | + | |
501 | 505 | | |
502 | 506 | | |
503 | 507 | | |
| |||
508 | 512 | | |
509 | 513 | | |
510 | 514 | | |
511 | | - | |
512 | | - | |
| 515 | + | |
| 516 | + | |
513 | 517 | | |
514 | 518 | | |
515 | 519 | | |
| |||
0 commit comments