Go to file
Eduardo Lima (Etrunko) 20bda4dba9 Fix demarshaller code generator
Even though commit df4ec5c318 commented
out most of smartcard code which triggered this error, it still might
happen if a new message is added with an array member.

The reason is a missing declaration of mem_size, which is fixed simply
by checking if the attribute 'nocopy' is present.

The error log follows:

generated_server_demarshallers.c: In function ‘parse_msgc_smartcard_reader_add’:
generated_server_demarshallers.c:1985:30: error: ‘mem_size’ undeclared (first use in this function); did you mean ‘nw_size’?
     data = (uint8_t *)malloc(mem_size);
                              ^~~~~~~~
                              nw_size

This patch also updates test-marshallers so that this bug is triggered.

The diff between generated demarshallers with the patch applied follows:

--- tests/generated_test_demarshallers.c.old    2018-05-17 14:35:29.234056487 -0300
+++ tests/generated_test_demarshallers.c        2018-05-17 14:35:40.554031295 -0300
@@ -286,6 +286,7 @@ static uint8_t * parse_msg_main_ArrayMes
     uint8_t *start = message_start;
     uint8_t *data = NULL;
     uint64_t nw_size;
+    uint64_t mem_size;
     uint8_t *in, *end;
     uint64_t name__nw_size;
     uint64_t name__nelements;
@@ -298,6 +299,7 @@ static uint8_t * parse_msg_main_ArrayMes
     }

     nw_size = 0 + name__nw_size;
+    mem_size = sizeof(SpiceMsgMainArrayMessage);

     /* Check if message fits in reported side */
     if (nw_size > (uintptr_t) (message_end - start)) {

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2018-05-17 21:02:58 +01:00
build-aux build-sys: make it a seperately buildable spice-common library 2012-03-22 20:21:05 +01:00
common build: Remove FIXME_SERVER_SMARTCARD hack 2018-05-17 15:11:37 +01:00
docs build-sys: don't dist spice-protocol.html 2017-03-28 14:57:50 +02:00
m4 Add --enable-extra-checks option 2018-03-19 14:47:21 +00:00
python_modules Fix demarshaller code generator 2018-05-17 21:02:58 +01:00
tests Fix demarshaller code generator 2018-05-17 21:02:58 +01:00
.gitmodules Remove spice-protocol submodule 2015-08-11 10:26:06 +02:00
autogen.sh Remove files moved to spice-protocol 2015-08-11 10:26:06 +02:00
configure.ac build: Remove FIXME_SERVER_SMARTCARD hack 2018-05-17 15:11:37 +01:00
COPYING Remove trailing whitespace 2015-12-18 11:41:15 +01:00
git.mk Update git.mk to latest version 2012-09-21 10:51:17 +02:00
Makefile.am Start adding protocol file documentation 2016-10-17 11:43:26 +01:00
spice1.proto Revert "Remove files moved to spice-protocol" 2016-03-10 16:01:36 +01:00
spice_codegen.py codegen: Fix license name 2017-05-18 16:40:36 +01:00
spice.proto Fix generation of Smartcard channel 2018-05-17 12:25:42 +01:00