William Manley
ade71fb544
gvariant: Don’t allow child elements to overlap with each other
...
If different elements of a variable sized array can overlap with each
other then we can cause a `GVariant` to normalise to a much larger type.
This commit changes the behaviour of `GVariant` with non-normal form data. If
an invalid frame offset is found all subsequent elements are given their
default value.
When retrieving an element at index `n` we scan the frame offsets up to index
`n` and if they are not in order we return an element with the default value
for that type. This guarantees that elements don't overlap with each
other. We remember the offset we've scanned up to so we don't need to
repeat this work on subsequent accesses. We skip these checks for trusted
data.
Unfortunately this makes random access of untrusted data O(n) — at least
on first access. It doesn't affect the algorithmic complexity of accessing
elements in order, such as when using the `GVariantIter` interface. Also:
the cost of validation will be amortised as the `GVariant` instance is
continued to be used.
I've implemented this with 4 different functions, 1 for each element size,
rather than looping calling `gvs_read_unaligned_le` in the hope that the
compiler will find it easy to optimise and should produce fairly tight
code.
Fixes : #2121
2022-12-13 18:14:26 +00:00
..
2022-06-01 12:44:23 +01:00
2021-04-19 19:23:10 +01:00
2019-01-15 15:11:43 +00:00
2022-10-31 12:00:53 +01:00
2022-10-13 20:53:56 -04:00
2022-12-13 18:14:26 +00:00
2022-11-22 17:23:14 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-11-29 12:16:11 +00:00
2022-05-27 15:27:19 +01:00
2022-10-13 23:56:18 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-06-23 13:19:05 +00:00
2022-11-22 17:23:12 +01:00
2022-11-07 11:30:32 +00:00
2022-11-07 11:30:32 +00:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-10-14 16:39:20 +01:00
2022-10-14 16:39:20 +01:00
2018-06-02 09:45:55 +02:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-06-27 17:53:25 -04:00
2022-05-23 09:19:45 -04:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-06-29 16:05:09 +02:00
2022-10-09 19:39:58 -04:00
2022-06-01 12:44:23 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-09-15 03:43:04 +02:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-10-31 12:02:57 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-10-24 10:46:57 +01:00
2022-11-28 12:58:05 +00:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-22 01:06:37 +00:00
2022-05-22 01:06:37 +00:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-12-02 21:35:21 +00:00
2022-06-23 10:47:22 +01:00
2022-06-23 10:47:22 +01:00
2022-05-18 09:19:02 +01:00
2022-07-25 01:00:54 +02:00
2022-07-25 01:00:54 +02:00
2022-07-05 10:41:49 +01:00
2022-05-18 09:19:02 +01:00
2020-11-17 15:50:07 +00:00
2018-08-25 23:59:45 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-10-27 19:54:26 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-11-03 00:11:45 +08:00
2022-11-03 00:11:45 +08:00
2022-11-22 17:23:12 +01:00
2022-11-02 09:06:34 -04:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2018-01-04 22:19:30 +01:00
2019-08-24 19:14:05 +00:00
2022-10-27 16:27:42 +00:00
2013-01-13 13:11:57 -05:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-11-24 17:47:56 +01:00
2022-05-18 09:19:02 +01:00
2022-08-02 12:35:56 -07:00
2022-05-27 12:58:10 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-10-26 18:07:55 +01:00
2022-07-25 22:30:22 +01:00
2022-11-22 16:25:39 +00:00
2022-05-18 09:19:02 +01:00
2022-11-03 00:11:45 +08:00
2022-11-22 17:23:13 +01:00
2021-09-21 09:41:29 +00:00
2022-05-22 01:06:37 +00:00
2022-05-22 01:06:37 +00:00
2022-05-18 09:19:02 +01:00
2022-07-13 15:58:24 +01:00
2021-11-18 14:32:09 +00:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-10-26 18:07:55 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-10-18 15:05:30 +01:00
2022-07-20 20:48:17 +00:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-09-15 03:43:04 +02:00
2022-05-22 01:06:37 +00:00
2022-05-22 01:06:37 +00:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-11-18 16:36:47 +00:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-12-12 11:28:58 +04:00
2022-11-03 00:11:45 +08:00
2022-12-12 11:28:58 +04:00
2022-12-12 11:28:58 +04:00
2022-05-18 14:40:23 +00:00
2022-05-18 09:19:02 +01:00
2022-11-22 16:25:39 +00:00
2022-11-02 21:26:34 +00:00
2022-11-07 13:01:47 +00:00
2022-10-19 14:53:45 +01:00
2022-11-04 13:13:13 -04:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2020-06-12 15:01:08 +01:00
2022-05-18 09:19:02 +01:00
2022-12-08 18:03:01 +00:00
2022-11-22 17:23:13 +01:00
2022-12-12 12:39:46 -06:00
2022-09-20 20:28:53 +05:30
2022-06-23 20:01:12 +02:00
2022-05-22 01:06:37 +00:00
2022-11-22 14:32:25 +00:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-10-24 12:35:29 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2014-02-20 18:27:24 -05:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-22 01:06:37 +00:00
2022-05-22 01:06:37 +00:00
2022-10-17 15:17:32 +02:00
2022-05-18 09:19:02 +01:00
2022-09-15 03:43:04 +02:00
2022-09-15 03:43:04 +02:00
2022-09-15 03:43:04 +02:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-09-15 03:43:04 +02:00
2022-05-18 09:19:02 +01:00
2022-09-15 03:43:04 +02:00
2022-09-15 03:43:04 +02:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-12-12 15:58:13 +01:00
2022-11-22 17:23:13 +01:00
2022-12-12 15:58:13 +01:00
2021-05-03 15:09:31 +02:00
2017-02-06 14:40:38 +01:00
2022-05-18 09:19:02 +01:00
2022-12-13 18:14:26 +00:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-11-08 16:14:02 +00:00
2022-12-13 18:14:26 +00:00
2022-12-13 18:14:26 +00:00
2022-12-13 17:36:33 +00:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-10-13 20:53:56 -04:00
2022-12-06 12:28:11 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2022-05-18 09:19:02 +01:00
2016-05-23 10:52:10 -04:00
2022-11-24 12:10:03 +00:00
2020-11-17 15:50:07 +00:00
2022-11-07 11:30:32 +00:00
2022-02-11 14:45:42 +00:00