diff options
author | David Robillard <d@drobilla.net> | 2012-12-21 18:26:55 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-12-21 18:26:55 +0000 |
commit | 73d0a86698528bf73d029e35a57ce7b38783cf2a (patch) | |
tree | cee6ad10793da41e78b3324a935c7cf94b1293fa /src | |
parent | 9d36ba3e802705b1d6236eefc99916af6116a448 (diff) | |
download | serd-73d0a86698528bf73d029e35a57ce7b38783cf2a.tar.gz serd-73d0a86698528bf73d029e35a57ce7b38783cf2a.tar.bz2 serd-73d0a86698528bf73d029e35a57ce7b38783cf2a.zip |
Fix crash when serd_node_new_decimal is called with infinity or NaN.
git-svn-id: http://svn.drobilla.net/serd/trunk@401 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src')
-rw-r--r-- | src/node.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -211,6 +211,10 @@ SERD_API SerdNode serd_node_new_decimal(double d, unsigned frac_digits) { + if (isnan(d) || isinf(d)) { + return SERD_NODE_NULL; + } + const double abs_d = fabs(d); const unsigned int_digits = (unsigned)fmax(1.0, ceil(log10(abs_d + 1))); char* buf = (char*)calloc(int_digits + frac_digits + 3, 1); |