1 /* 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 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 11 #include <stddef.h> 12 #include "zstd.h" 13 14 static const char invalidRepCode[] = { 15 0x37, 0xa4, 0x30, 0xec, 0x2a, 0x00, 0x00, 0x00, 0x39, 0x10, 0xc0, 0xc2, 16 0xa6, 0x00, 0x0c, 0x30, 0xc0, 0x00, 0x03, 0x0c, 0x30, 0x20, 0x72, 0xf8, 17 0xb4, 0x6d, 0x4b, 0x9f, 0xfc, 0x97, 0x29, 0x49, 0xb2, 0xdf, 0x4b, 0x29, 18 0x7d, 0x4a, 0xfc, 0x83, 0x18, 0x22, 0x75, 0x23, 0x24, 0x44, 0x4d, 0x02, 19 0xb7, 0x97, 0x96, 0xf6, 0xcb, 0xd1, 0xcf, 0xe8, 0x22, 0xea, 0x27, 0x36, 20 0xb7, 0x2c, 0x40, 0x46, 0x01, 0x08, 0x23, 0x01, 0x00, 0x00, 0x06, 0x1e, 21 0x3c, 0x83, 0x81, 0xd6, 0x18, 0xd4, 0x12, 0x3a, 0x04, 0x00, 0x80, 0x03, 22 0x08, 0x0e, 0x12, 0x1c, 0x12, 0x11, 0x0d, 0x0e, 0x0a, 0x0b, 0x0a, 0x09, 23 0x10, 0x0c, 0x09, 0x05, 0x04, 0x03, 0x06, 0x06, 0x06, 0x02, 0x00, 0x03, 24 0x00, 0x00, 0x02, 0x02, 0x00, 0x04, 0x06, 0x03, 0x06, 0x08, 0x24, 0x6b, 25 0x0d, 0x01, 0x10, 0x04, 0x81, 0x07, 0x00, 0x00, 0x04, 0xb9, 0x58, 0x18, 26 0x06, 0x59, 0x92, 0x43, 0xce, 0x28, 0xa5, 0x08, 0x88, 0xc0, 0x80, 0x88, 27 0x8c, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 28 0x08, 0x00, 0x00, 0x00 29 }; 30 31 typedef struct dictionary_s { 32 const char *data; 33 size_t size; 34 } dictionary; 35 36 static const dictionary dictionaries[] = { 37 {invalidRepCode, sizeof(invalidRepCode)}, 38 {NULL, 0}, 39 }; 40 41 int main(int argc, const char** argv) { 42 const dictionary *dict; 43 for (dict = dictionaries; dict->data != NULL; ++dict) { 44 ZSTD_CDict *cdict; 45 ZSTD_DDict *ddict; 46 cdict = ZSTD_createCDict(dict->data, dict->size, 1); 47 if (cdict) { 48 ZSTD_freeCDict(cdict); 49 return 1; 50 } 51 ddict = ZSTD_createDDict(dict->data, dict->size); 52 if (ddict) { 53 ZSTD_freeDDict(ddict); 54 return 2; 55 } 56 } 57 58 (void)argc; 59 (void)argv; 60 return 0; 61 } 62