Rizin
unix-like reverse engineering framework and cli tools
stream_flags_common.c File Reference

Common stuff for Stream flags coders. More...

Go to the source code of this file.

Functions

 LZMA_API (lzma_ret)
 

Variables

const uint8_t lzma_header_magic [6] = { 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00 }
 
const uint8_t lzma_footer_magic [2] = { 0x59, 0x5A }
 

Detailed Description

Common stuff for Stream flags coders.

Definition in file stream_flags_common.c.

Function Documentation

◆ LZMA_API()

LZMA_API ( lzma_ret  )

Definition at line 20 of file stream_flags_common.c.

23 {
24  // We can compare only version 0 structures.
25  if (a->version != 0 || b->version != 0)
26  return LZMA_OPTIONS_ERROR;
27 
28  // Check type
29  if ((unsigned int)(a->check) > LZMA_CHECK_ID_MAX
30  || (unsigned int)(b->check) > LZMA_CHECK_ID_MAX)
31  return LZMA_PROG_ERROR;
32 
33  if (a->check != b->check)
34  return LZMA_DATA_ERROR;
35 
36  // Backward Sizes are compared only if they are known in both.
37  if (a->backward_size != LZMA_VLI_UNKNOWN
38  && b->backward_size != LZMA_VLI_UNKNOWN) {
40  return LZMA_PROG_ERROR;
41 
42  if (a->backward_size != b->backward_size)
43  return LZMA_DATA_ERROR;
44  }
45 
46  return LZMA_OK;
47 }
#define LZMA_CHECK_ID_MAX
Maximum valid Check ID.
Definition: check.h:68
#define b(i)
Definition: sha256.c:42
#define a(i)
Definition: sha256.c:41
static bool is_backward_size_valid(const lzma_stream_flags *options)
#define LZMA_VLI_UNKNOWN
VLI value to denote that the value is unknown.
Definition: vli.h:39
@ LZMA_PROG_ERROR
Programming error.
Definition: base.h:218
@ LZMA_DATA_ERROR
Data is corrupt.
Definition: base.h:172
@ LZMA_OPTIONS_ERROR
Invalid or unsupported options.
Definition: base.h:160
@ LZMA_OK
Operation completed successfully.
Definition: base.h:58

References a, b, is_backward_size_valid(), LZMA_CHECK_ID_MAX, LZMA_DATA_ERROR, LZMA_OK, LZMA_OPTIONS_ERROR, LZMA_PROG_ERROR, and LZMA_VLI_UNKNOWN.

Variable Documentation

◆ lzma_footer_magic

const uint8_t lzma_footer_magic[2] = { 0x59, 0x5A }

Definition at line 17 of file stream_flags_common.c.

◆ lzma_header_magic

const uint8_t lzma_header_magic[6] = { 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00 }

Definition at line 16 of file stream_flags_common.c.

Referenced by LZMA_API().