invalidDictionaries.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright (c) 2016-2021, Yann Collet, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under both the BSD-style license (found in the
  6. * LICENSE file in the root directory of this source tree) and the GPLv2 (found
  7. * in the COPYING file in the root directory of this source tree).
  8. * You may select, at your option, one of the above-listed licenses.
  9. */
  10. #include <stddef.h>
  11. #include "zstd.h"
  12. static const char invalidRepCode[] = {
  13. 0x37, 0xa4, 0x30, 0xec, 0x2a, 0x00, 0x00, 0x00, 0x39, 0x10, 0xc0, 0xc2,
  14. 0xa6, 0x00, 0x0c, 0x30, 0xc0, 0x00, 0x03, 0x0c, 0x30, 0x20, 0x72, 0xf8,
  15. 0xb4, 0x6d, 0x4b, 0x9f, 0xfc, 0x97, 0x29, 0x49, 0xb2, 0xdf, 0x4b, 0x29,
  16. 0x7d, 0x4a, 0xfc, 0x83, 0x18, 0x22, 0x75, 0x23, 0x24, 0x44, 0x4d, 0x02,
  17. 0xb7, 0x97, 0x96, 0xf6, 0xcb, 0xd1, 0xcf, 0xe8, 0x22, 0xea, 0x27, 0x36,
  18. 0xb7, 0x2c, 0x40, 0x46, 0x01, 0x08, 0x23, 0x01, 0x00, 0x00, 0x06, 0x1e,
  19. 0x3c, 0x83, 0x81, 0xd6, 0x18, 0xd4, 0x12, 0x3a, 0x04, 0x00, 0x80, 0x03,
  20. 0x08, 0x0e, 0x12, 0x1c, 0x12, 0x11, 0x0d, 0x0e, 0x0a, 0x0b, 0x0a, 0x09,
  21. 0x10, 0x0c, 0x09, 0x05, 0x04, 0x03, 0x06, 0x06, 0x06, 0x02, 0x00, 0x03,
  22. 0x00, 0x00, 0x02, 0x02, 0x00, 0x04, 0x06, 0x03, 0x06, 0x08, 0x24, 0x6b,
  23. 0x0d, 0x01, 0x10, 0x04, 0x81, 0x07, 0x00, 0x00, 0x04, 0xb9, 0x58, 0x18,
  24. 0x06, 0x59, 0x92, 0x43, 0xce, 0x28, 0xa5, 0x08, 0x88, 0xc0, 0x80, 0x88,
  25. 0x8c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
  26. 0x08, 0x00, 0x00, 0x00
  27. };
  28. typedef struct dictionary_s {
  29. const char *data;
  30. size_t size;
  31. } dictionary;
  32. static const dictionary dictionaries[] = {
  33. {invalidRepCode, sizeof(invalidRepCode)},
  34. {NULL, 0},
  35. };
  36. int main(int argc, const char** argv) {
  37. const dictionary *dict;
  38. for (dict = dictionaries; dict->data != NULL; ++dict) {
  39. ZSTD_CDict *cdict;
  40. ZSTD_DDict *ddict;
  41. cdict = ZSTD_createCDict(dict->data, dict->size, 1);
  42. if (cdict) {
  43. ZSTD_freeCDict(cdict);
  44. return 1;
  45. }
  46. ddict = ZSTD_createDDict(dict->data, dict->size);
  47. if (ddict) {
  48. ZSTD_freeDDict(ddict);
  49. return 2;
  50. }
  51. }
  52. (void)argc;
  53. (void)argv;
  54. return 0;
  55. }