Philip Withnall f9d165add1 guri: Fix buffer overrun when decoding %-encoded URI components
There is a limited (1 or 2 byte) read off the end of the buffer if its
final or penultimate byte is `%` and it’s not nul-terminated after that.
If the buffer *is* nul-terminated then the first `g_ascii_isxdigit()`
call safely returns `FALSE` and the code moves on.

Fix it by adding an additional check, and some unit tests to catch the
behaviour.

This bug is present in libsoup, which `GUri` is based on, but not
exploitable due to how the external API only exposes nul-terminated
strings. See https://gitlab.gnome.org/GNOME/libsoup/-/merge_requests/126
for the fix there.

oss-fuzz#23815
oss-fuzz#23818

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2020-07-01 13:28:09 +01:00
..
2017-05-24 11:58:19 +02:00
2010-07-10 23:56:45 -04:00
2017-05-24 11:58:19 +02:00
2017-02-20 12:40:26 +01:00
2014-10-02 14:41:01 -04:00
2010-07-05 23:43:47 -04:00
2018-12-17 16:19:31 -05:00
2011-02-13 23:49:19 -05:00
2018-12-28 15:30:28 +01:00
2017-05-24 11:58:19 +02:00
2013-11-23 00:39:07 -05:00
2010-07-07 22:03:02 -04:00
2020-03-05 09:39:33 +01:00
2020-01-21 19:54:55 +04:00
2017-05-24 11:58:19 +02:00
2011-01-27 23:07:53 -05:00
2020-06-23 10:49:44 +01:00
2017-05-24 11:58:19 +02:00
2018-12-17 17:16:03 +00:00
2015-09-12 11:13:45 -04:00
2015-08-31 13:59:48 -04:00
2020-02-07 16:24:48 +02:00
2019-11-25 13:09:25 +01:00