Varargs in jansson using json_vpack_ex

56 views
Skip to first unread message

Martin Assarsson

unread,
Apr 12, 2013, 5:31:05 AM4/12/13
to jansso...@googlegroups.com
Hi!

I'm using jansson in a multithreaded program on an embedded arm-system.
This system is build with "buildroot" using bussybox and uclibc.
When using the construction below I get heap corruption and use a different aproach at the moment.
Is there anybody else experiencing this problem?
Any solution?
I would like to reinstate the varargs approach.

va_list ap;
va_start(ap, fmt);
obj = json_vpack_ex(NULL, 0, fmt, ap);
va_end(ap);

  // Martin

Petri Lehtinen

unread,
Apr 12, 2013, 5:53:13 AM4/12/13
to jansso...@googlegroups.com
json_vpack_ex() uses va_copy() to make it possible to pass ap to
another function as an argument. If va_copy() is not available as a
macro, Jansson uses either __va_copy or simple memcpy() as a fallback.

Do you happen to know whether uclibc supports va_copy() on your
platform?

Petri

Martin Assarsson

unread,
Apr 12, 2013, 6:45:53 AM4/12/13
to jansso...@googlegroups.com
Thanks for quick response!
Afaik this depends on compiler compliance with C99. My compiler has this version
arm-unknown-linux-uclibcgnueabi-gcc (Buildroot 2012.05) 4.5.3
Correct me if I'm wrong, but it should mean that it has a va_copy.

  // Martin

Petri Lehtinen

unread,
Apr 12, 2013, 6:53:41 AM4/12/13
to jansso...@googlegroups.com
Yeah, va_copy() should be ok in this case. I can't think of any other
(Jansson related) causes for your problem. Let us know if you find out
how to make it work.

Petri
> --
> --
> Jansson users mailing list
> jansso...@googlegroups.com
> http://groups.google.com/group/jansson-users
> ---
> You received this message because you are subscribed to the Google Groups
> "Jansson users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to jansson-user...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Martin Assarsson

unread,
Apr 12, 2013, 6:54:45 AM4/12/13
to jansso...@googlegroups.com
Thanks for your time, I will dig in to it later.

  // Martin
Reply all
Reply to author
Forward
0 new messages