Skip to content
This repository has been archived by the owner on Jan 27, 2022. It is now read-only.

Fix for SIGSEGV when bad payload comes in #1

Open
wants to merge 1 commit into
base: cmake-install-instructions
Choose a base branch
from

Conversation

racerxdl
Copy link

For some reason the attached payload crashes the library with a SIGSEGV. The fix solves the issue by just returning error.

Test code:

#include <szlib.h>
#include <stdio.h>

int main() {
  int inputLength = 731;
  char output[5424];
  char input[731];

  SZ_com_t params;

  FILE *f = fopen("input.bin", "rb");
  fread(input, inputLength, 1, f);
  fclose(f);

  //  {options_mask = 177, bits_per_pixel = 8, pixels_per_block = 32, pixels_per_scanline = 5424}
  params.options_mask = 177;
  params.bits_per_pixel = 8;
  params.pixels_per_block = 32;
  params.pixels_per_scanline = 5424;

  size_t destLen = 5424;
  int status = SZ_BufftoBuffDecompress(output, &destLen, input, inputLength, &params);
  f = fopen("raw.dec", "wb");
  fwrite(output, destLen, 1, f);
  fclose(f);

  return status != AEC_OK ? status : destLen;
}

input.zip

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant