Coverage Report

Created: 2026-01-13 06:54

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/perfetto/buildtools/lzma/C/Lzma86Dec.c
Line
Count
Source
1
/* Lzma86Dec.c -- LZMA + x86 (BCJ) Filter Decoder
2
2016-05-16 : Igor Pavlov : Public domain */
3
4
#include "Precomp.h"
5
6
#include "Lzma86.h"
7
8
#include "Alloc.h"
9
#include "Bra.h"
10
#include "LzmaDec.h"
11
12
SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize)
13
0
{
14
0
  unsigned i;
15
0
  if (srcLen < LZMA86_HEADER_SIZE)
16
0
    return SZ_ERROR_INPUT_EOF;
17
0
  *unpackSize = 0;
18
0
  for (i = 0; i < sizeof(UInt64); i++)
19
0
    *unpackSize += ((UInt64)src[LZMA86_SIZE_OFFSET + i]) << (8 * i);
20
0
  return SZ_OK;
21
0
}
22
23
SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen)
24
0
{
25
0
  SRes res;
26
0
  int useFilter;
27
0
  SizeT inSizePure;
28
0
  ELzmaStatus status;
29
30
0
  if (*srcLen < LZMA86_HEADER_SIZE)
31
0
    return SZ_ERROR_INPUT_EOF;
32
33
0
  useFilter = src[0];
34
35
0
  if (useFilter > 1)
36
0
  {
37
0
    *destLen = 0;
38
0
    return SZ_ERROR_UNSUPPORTED;
39
0
  }
40
41
0
  inSizePure = *srcLen - LZMA86_HEADER_SIZE;
42
0
  res = LzmaDecode(dest, destLen, src + LZMA86_HEADER_SIZE, &inSizePure,
43
0
      src + 1, LZMA_PROPS_SIZE, LZMA_FINISH_ANY, &status, &g_Alloc);
44
0
  *srcLen = inSizePure + LZMA86_HEADER_SIZE;
45
0
  if (res != SZ_OK)
46
0
    return res;
47
0
  if (useFilter == 1)
48
0
  {
49
0
    UInt32 x86State;
50
0
    x86_Convert_Init(x86State);
51
0
    x86_Convert(dest, *destLen, 0, &x86State, 0);
52
0
  }
53
0
  return SZ_OK;
54
0
}