CONTRIB: hpack: make use of the simplified standalone HPACK API
As reported in oss-fuzz issue 22388, the contrib/hpack code doesn't build anymore for now. Thanks to previous patch we can now just define HPACK_STANDALONE in the few files which include hpack-tbl.h and we can declare a dummy pool to hold the DHT size. This is enough to make the code work again outside of the haproxy process. It was successfully tested using: $ echo 82 84 87 90 | ./decode
This commit is contained in:
parent
0ff9b3d64f
commit
318adf4364
|
@ -10,6 +10,9 @@
|
|||
* gcc -I../../include -I../../ebtree -O0 -g -fno-strict-aliasing -fwrapv \
|
||||
* -o decode decode.c
|
||||
*/
|
||||
|
||||
#define HPACK_STANDALONE
|
||||
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
@ -153,6 +156,7 @@ int main(int argc, char **argv)
|
|||
{
|
||||
struct hpack_dht *dht;
|
||||
struct http_hdr list[MAX_HDR_NUM];
|
||||
struct pool_head pool;
|
||||
int outlen;
|
||||
int dht_size = 4096;
|
||||
int len, idx;
|
||||
|
@ -164,7 +168,9 @@ int main(int argc, char **argv)
|
|||
argv++; argc--;
|
||||
}
|
||||
|
||||
dht = hpack_dht_alloc(dht_size);
|
||||
pool.size = dht_size;
|
||||
pool_head_hpack_tbl = &pool;
|
||||
dht = hpack_dht_alloc();
|
||||
if (!dht) {
|
||||
die(1, "cannot initialize dht\n");
|
||||
return 1;
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
* Build like this :
|
||||
* gcc -I../../include -I../../ebtree -o gen-enc gen-enc.c
|
||||
*/
|
||||
#define HPACK_STANDALONE
|
||||
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
|
Loading…
Reference in New Issue