<feed xmlns='http://www.w3.org/2005/Atom'>
<title>fortify-headers, branch 1.1</title>
<subtitle>Standalone portable header-based implementation of FORTIFY_SOURCE=3 
</subtitle>
<id>http://git.dustri.org/fortify-headers/atom?h=1.1</id>
<link rel='self' href='http://git.dustri.org/fortify-headers/atom?h=1.1'/>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/'/>
<updated>2019-04-14T08:25:54Z</updated>
<entry>
<title>Bump to 1.1</title>
<updated>2019-04-14T08:25:54Z</updated>
<author>
<name>sin</name>
</author>
<published>2019-04-14T08:25:54Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=e3fee64643279c144efd3d6856ed4e818c0d5ca2'/>
<id>urn:sha1:e3fee64643279c144efd3d6856ed4e818c0d5ca2</id>
<content type='text'>
</content>
</entry>
<entry>
<title>getgroups: do not trap on non-positive gidsetsize</title>
<updated>2019-03-13T17:47:50Z</updated>
<author>
<name>info@mobile-stream.com</name>
</author>
<published>2019-03-13T12:55:48Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=9e65ae387cb7dc955042a1c98c4e8448b01e172c'/>
<id>urn:sha1:9e65ae387cb7dc955042a1c98c4e8448b01e172c</id>
<content type='text'>
First, we should never check the size of __s if __l == 0 since the
array is not going to be modified in that case.

Second, negative __l is a well-defined error case (EINVAL) and we
should never trap on a conforming code like this:

r = getgroups(-1, NULL);
if (r == -1)
  ...

An example of non-desired behaviour for negative __l is the gnulib
configure script which checks for getgroups(-1, ...) to catch some
ancient FreeBSD kernel bug. The conftest binary traps even on good
system (e.g. linux/musl) and the unnecessary getgroups wrapper is
enforced for any project that uses gnulib.

This patch also changes the size_t cast to avoid the explicit zero
extension on systems where size_t differs from unsigned int.
</content>
</entry>
<entry>
<title>wctomb, wcrtomb: guard slow/trap path with MB_LEN_MAX</title>
<updated>2019-03-07T00:05:34Z</updated>
<author>
<name>info@mobile-stream.com</name>
</author>
<published>2019-03-06T13:28:48Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=9b796691eb794e9f5279886e917c028a09f8a728'/>
<id>urn:sha1:9b796691eb794e9f5279886e917c028a09f8a728</id>
<content type='text'>
This allows the compiler to optimize out the slow/trap path at all
for the typical correct code:

char buf[MB_LEN_MAX];
r = wctomb(buf, c);

The change tries to keep the "unknown object size" case handling in
wcrtomb() as is even if it seems redundant and not helping (we copy
__buf to possibly undersized __s in any case) and inconsistent with
wctomb() (where we let the original library method itself overwrite
the possibly undersized __s).
</content>
</entry>
<entry>
<title>realpath: guard slow/trap path with PATH_MAX</title>
<updated>2019-03-07T00:05:30Z</updated>
<author>
<name>info@mobile-stream.com</name>
</author>
<published>2019-03-06T13:28:48Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=ff82ffbc74d82091527449e31fe351d15830f716'/>
<id>urn:sha1:ff82ffbc74d82091527449e31fe351d15830f716</id>
<content type='text'>
This allows the compiler to optimize out the slow/trap path at all
for the typical correct code:

char buf[PATH_MAX];
r = realpath(path, buf);

The change keeps the "unknown object size" case handling intact.
</content>
</entry>
<entry>
<title>Bump copyright</title>
<updated>2019-02-25T13:22:33Z</updated>
<author>
<name>sin</name>
</author>
<published>2019-02-25T13:22:33Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=1435d8186b1954de640ec79717c5e564243bd350'/>
<id>urn:sha1:1435d8186b1954de640ec79717c5e564243bd350</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Make use of builtins whenever possible</title>
<updated>2019-02-25T13:17:08Z</updated>
<author>
<name>sin</name>
</author>
<published>2019-02-25T13:01:12Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=5aabc7e6aad28327d75671e52c50060e4543112c'/>
<id>urn:sha1:5aabc7e6aad28327d75671e52c50060e4543112c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Bump to 1.0</title>
<updated>2018-07-24T10:01:30Z</updated>
<author>
<name>sin</name>
</author>
<published>2018-07-24T10:01:30Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=ad9a6d93b7ad46cf7998f3df753e94a684ac9b37'/>
<id>urn:sha1:ad9a6d93b7ad46cf7998f3df753e94a684ac9b37</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Don't use __extension__ in C++ code</title>
<updated>2018-07-24T10:00:30Z</updated>
<author>
<name>A. Wilcox</name>
</author>
<published>2018-06-23T22:57:48Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=a9ffac8596b094da8563aa5dd5d81c946670afe5'/>
<id>urn:sha1:a9ffac8596b094da8563aa5dd5d81c946670afe5</id>
<content type='text'>
A few important notes:

*  __extension__ is a GNU C "alternate" keyword, not a C++ keyword.[1]

*  __extension__ is designed to work on "expressions"; it does work on
   #include_next in C mode, but it has no effect in C++ mode; the
   warning will still appear, if enabled, even with __extension__
   preceding #include_next.  This is because #include_next is not
   considered an expression in C++, so the compiler attaches
   __extension__ to the first expression of the header.

All of this leads us to a build failure while building at least all
Mozilla software.  Moz has an alternate -isystem dir searched before
/usr/include that overrides some headers, including &lt;features.h&gt;.  The
first statement in each of these headers is a #pragma, and since
__extension__ is looking for an expression, and #pragma is a "null"
expression, we end up with the following error:

dist/system_wrappers/features.h:1:9: error: '#pragma' is not allowed here

Since __extension__ has no effect on #include_next in C++ mode anyway,
and since it can cause breakage, this commit omits __extension__ in C++
mode.

[1]: https://gcc.gnu.org/onlinedocs/gcc-6.4.0/gcc/Alternate-Keywords.html
</content>
</entry>
<entry>
<title>Bump to 0.9</title>
<updated>2017-08-22T10:38:57Z</updated>
<author>
<name>sin</name>
</author>
<published>2017-08-22T10:38:57Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=6e7e43ff992fa232b186cec9fc2920ca260c27a6'/>
<id>urn:sha1:6e7e43ff992fa232b186cec9fc2920ca260c27a6</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Don't trap if an encoding error occurs in wcrtomb()</title>
<updated>2017-08-22T10:38:36Z</updated>
<author>
<name>sin</name>
</author>
<published>2017-08-22T10:31:49Z</published>
<link rel='alternate' type='text/html' href='http://git.dustri.org/fortify-headers/commit/?id=9730e9d297068f7555621891072360c58095efc8'/>
<id>urn:sha1:9730e9d297068f7555621891072360c58095efc8</id>
<content type='text'>
The POSIX definition of wcrtomb
(http://pubs.opengroup.org/onlinepubs/9699919799/functions/wcrtomb.html)
states:

"When wc is not a valid wide character, an encoding error shall occur.
In this case, the function shall store the value of the macro [EILSEQ]
in errno and shall return (size_t)-1; the conversion state shall be
undefined."

The fortify-headers implementation of wcrtomb interprets the result -1
as 18446744073709551615 bytes. Since this is the highest 64-bit number
possible, it is pretty safe to say this will always be larger than any
buffer provided to wcrtomb. Therefore, it traps.

Fixes bug https://bugs.alpinelinux.org/issues/7681.

Patch by A. Wilcox &lt;AWilcox@Wilcox-Tech.com&gt;
</content>
</entry>
</feed>
