Hdp from hdf4-tools division by zero
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libhdf4 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Hello,
Below is some description about crash, found by dynamic analysis tool Sydr (part of Crusher system) https:/
System Ubuntu 20.04.2 LTS.
Package: libhdf4_
Division by zero:
(gdb) r
Starting program: /home/fedotoff/
Program received signal SIGFPE, Arithmetic exception.
0x00000000004ba4d8 in VSread (vkey=1073741846, buf=0x7ffbf7be4010 "", nelt=2147483647, interlace=0) at vrw.c:276
276 chunk = buf_size / hsize + 1;
(gdb) bt
#0 0x00000000004ba4d8 in VSread (vkey=1073741846, buf=0x7ffbf7be4010 "", nelt=2147483647, interlace=0) at vrw.c:276
#1 0x0000000000420186 in hdf_read_attrs (xdrs=0x5193a0, handle=0x518330, vg=805306379) at cdf.c:2252
#2 0x0000000000420c34 in hdf_read_vars (xdrs=0x5193a0, handle=0x518330, vg=805306368) at cdf.c:2669
#3 0x00000000004211c8 in hdf_read_xdr_cdf (xdrs=0x5193a0, handlep=
#4 0x000000000041d8e9 in hdf_xdr_cdf (xdrs=0x5193a0, handlep=
#5 0x000000000041d3c3 in xdr_cdf (xdrs=0x5193a0, handlep=
#6 0x000000000041d299 in NC_new_cdf (name=0x7ffffff
#7 0x00000000004233d6 in NC_open (path=0x7ffffff
#8 0x000000000042353e in ncopen (path=0x7ffffff
#9 0x0000000000429b00 in SDstart (name=0x7ffffff
#10 0x0000000000410cc7 in dsd (dumpsds_
#11 0x00000000004116d7 in do_dumpsds (curr_arg=2, argc=3, argv=0x7fffffff
#12 0x0000000000402950 in main (argc=3, argv=0x7fffffff
(gdb) list
271
272 /* we are bounded above by VDATA_BUFFER_MAX */
273 buf_size = MIN(total_bytes, VDATA_BUFFER_MAX);
274
275 /* make sure there is at least room for one record in our buffer */
276 chunk = buf_size / hsize + 1;
277
278 /* get a buffer big enough to hold the values */
279 Vtbufsize = (size_t)chunk * (size_t)hsize;
280 if (Vtbuf)
(gdb) p/x hsize
$1 = 0x0
Suggestion for fix: check hsize if it is zero, and set chunk = 1;
description: | updated |
summary: |
- Hdp for hdf4-tools division by zero + Hdp from hdf4-tools division by zero |