Skip to content
  • Philip Withnall's avatar
    gvariant-parser: Speed up maybe_wrapper() by an order of magnitude · 9ae59bd6
    Philip Withnall authored
    This further helps with the potential denial of service problem in
    issue #2782 / oss-fuzz#49462 / oss-fuzz#20177.
    
    Instead of allocating a new `GVariant` for each nesting level of
    maybe-types, allocate a single `GVariant` and give it the fully-nested
    maybe type as its type. This has to be done in serialised form.
    
    This prevents attackers from triggering O(size of container × typedecl
    depth) allocations.
    
    This is a follow up to commit 3e313438
    
    ,
    and includes a test.
    
    Signed-off-by: default avatarPhilip Withnall <pwithnall@endlessos.org>
    Fixes: #2782
    oss-fuzz#20177
    oss-fuzz#49462
    9ae59bd6