On Mon, Oct 16, 2023 at 11:18 AM Federico Fiorani <defer...@gmail.com> wrote:
>
> Hi everybody,
> the following script crashes on Windows (gretl 2023c-git build date 
> 2023-10-07) when I try to convert to a bundle.
>
> <code>
> bundle bun = null
> bun.header = "text/html,application/xhtml+xml,application/xml"
> bun.URL = "http://dataservices.imf.org/REST/SDMX_JSON.svc/Dataflow";
> curl(&bun)
> a = bread(bun.output)
> </code>

Gretl should not crash in this case (or ever!), but the usage of
bread() in this script is wrong.

bread() is designed to read a bundle from file, and the argument
should be a filename. You are passing instead bun.output, a string
holding 100429 bytes of JSON, much longer than is expected for a
filename. And this results in a buffer overflow. This is now fixed in
git: we flag an error if the putative "filename" is too long. So
running the script above now gives:

Filename too long, 100429 bytes
Terminated on error

But you don't really want bread() at all in this context: bun.output
itself is already the JSON you're looking for.

Allin.
_______________________________________________
Gretl-users mailing list -- gretl-users@gretlml.univpm.it
To unsubscribe send an email to gretl-users-le...@gretlml.univpm.it
Website: 
https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/

Reply via email to