Valgrind Report for ext/interbase/tests/007.phpt ('InterBase: array handling')
Script
1:
<?php 2: 3: require("interbase.inc"); 4: 5: ibase_connect($test_base); 6: 7: ibase_query( 8: "create table test7 ( 9: iter integer, 10: v_multi integer[10,10,10], 11: v_char char(100)[10], 12: v_date timestamp[10], 13: v_decimal decimal(18,3)[10], 14: v_double double precision[10], 15: v_float float[10], 16: v_integer integer[10], 17: v_numeric numeric(9,2)[10], 18: v_smallint smallint[10], 19: v_varchar varchar(1000)[10] 20: )"); 21: ibase_commit(); 22: 23: /* if timefmt not supported, hide error */ 24: ini_set('ibase.timestampformat',"%m/%d/%Y %H:%M:%S"); 25: 26: echo "insert\n"; 27: 28: for ($i = 1; $i <= 10; ++$i) { 29: for ($j = 1; $j <= 10; ++$j) { 30: for ($k = 1; $k <= 10; ++$k) { 31: $v_multi[$i][$j][$k] = $i * $j * $k; 32: } 33: } 34: } 35: 36: for($iter = 0; $iter < 3; $iter++) { 37: 38: /* prepare data */ 39: $v_char = array(); 40: $v_date = array(); 41: $v_decimal = array(); 42: $v_double = array(); 43: $v_float = array(); 44: $v_integer = array(); 45: $v_numeric = array(); 46: $v_smallint = array(); 47: $v_varchar = array(); 48: 49: for ($i = 1; $i <= 10; ++$i) { 50: $v_char[$i] = rand_str(100); 51: $v_date[$i] = rand_datetime(); 52: $v_decimal[$i] = rand_number(18,3); 53: $v_double[$i] = rand_number(20); 54: $v_float[$i] = rand_number(7); 55: $v_integer[$i] = rand_number(9,0); 56: $v_numeric[$i] = rand_number(9,2); 57: $v_smallint[$i] = rand_number(5) % 32767; 58: $v_varchar[$i] = rand_str(1000); 59: } 60: 61: ibase_query("insert into test7 62: (iter,v_multi,v_char,v_date,v_decimal,v_double,v_float, 63: v_integer,v_numeric,v_smallint,v_varchar) 64: values (?,?,?,?,?,?,?,?,?,?,?)", 65: $iter, $v_multi, $v_char, $v_date, $v_decimal, $v_double, $v_float, 66: $v_integer, $v_numeric, $v_smallint, $v_varchar); 67: $sel = ibase_query("select * from test7 where iter = $iter"); 68: 69: $row = ibase_fetch_object($sel,IBASE_FETCH_ARRAYS); 70: for ($i = 1; $i <= 10; ++$i) { 71: 72: if(strncmp($row->V_CHAR[$i],$v_char[$i],strlen($v_char[$i])) != 0) { 73: echo " CHAR[$i] fail:\n"; 74: echo " in: ".$v_char[$i]."\n"; 75: echo " out: ".$row->V_CHAR[$i]."\n"; 76: } 77: if($row->V_DATE[$i] != $v_date[$i]) { 78: echo " DATE[$i] fail\n"; 79: echo " in: ".$v_date[$i]."\n"; 80: echo " out: ".$row->V_DATE[$i]."\n"; 81: } 82: if($row->V_DECIMAL[$i] != $v_decimal[$i]) { 83: echo " DECIMAL[$i] fail\n"; 84: echo " in: ".$v_decimal[$i]."\n"; 85: echo " out: ".$row->V_DECIMAL[$i]."\n"; 86: } 87: if(abs($row->V_DOUBLE[$i] - $v_double[$i]) > abs($v_double[$i] / 1E15)) { 88: echo " DOUBLE[$i] fail\n"; 89: echo " in: ".$v_double[$i]."\n"; 90: echo " out: ".$row->V_DOUBLE[$i]."\n"; 91: } 92: if(abs($row->V_FLOAT[$i] - $v_float[$i]) > abs($v_float[$i] / 1E7)) { 93: echo " FLOAT[$i] fail\n"; 94: echo " in: ".$v_float[$i]."\n"; 95: echo " out: ".$row->V_FLOAT[$i]."\n"; 96: } 97: if($row->V_INTEGER[$i] != $v_integer[$i]) { 98: echo " INTEGER[$i] fail\n"; 99: echo " in: ".$v_integer[$i]."\n"; 100: echo " out: ".$row->V_INTEGER[$i]."\n"; 101: } 102: if ($row->V_NUMERIC[$i] != $v_numeric[$i]) { 103: echo " NUMERIC[$i] fail\n"; 104: echo " in: ".$v_numeric[$i]."\n"; 105: echo " out: ".$row->V_NUMERIC[$i]."\n"; 106: } 107: if ($row->V_SMALLINT[$i] != $v_smallint[$i]) { 108: echo " SMALLINT[$i] fail\n"; 109: echo " in: ".$v_smallint[$i]."\n"; 110: echo " out: ".$row->V_SMALLINT[$i]."\n"; 111: } 112: if ($row->V_VARCHAR[$i] != $v_varchar[$i]) { 113: echo " VARCHAR[$i] fail:\n"; 114: echo " in: ".$v_varchar[$i]."\n"; 115: echo " out: ".$row->V_VARCHAR[$i]."\n"; 116: } 117: } 118: ibase_free_result($sel); 119: }/* for($iter) */ 120: 121: echo "select\n"; 122: 123: $sel = ibase_query("SELECT v_multi[5,5,5],v_multi[10,10,10] FROM test7 WHERE iter = 0"); 124: print_r(ibase_fetch_row($sel)); 125: ibase_free_result($sel); 126: 127: for($iter = 1; $iter <= 3; $iter++) { 128: 129: if(!($sel = ibase_query( 130: "select iter from test7 where v_char[$iter] LIKE ?", $v_char[$iter]."%")) || 131: !ibase_fetch_row($sel)) { 132: echo "CHAR fail\n"; 133: } 134: ibase_free_result($sel); 135: 136: if(!($sel = ibase_query( 137: "select iter from test7 where v_date[$iter] = ?", $v_date[$iter])) || 138: !ibase_fetch_row($sel)) { 139: echo "DATE fail\n"; 140: } 141: ibase_free_result($sel); 142: if(!($sel = ibase_query( 143: "select iter from test7 where v_decimal[$iter] = ?", $v_decimal[$iter])) || 144: !ibase_fetch_row($sel)) { 145: echo "DECIMAL fail\n"; 146: } 147: ibase_free_result($sel); 148: if(!($sel = ibase_query( 149: "select iter from test7 where v_integer[$iter] = ?", $v_integer[$iter])) || 150: !ibase_fetch_row($sel)) { 151: echo "INTEGER fail\n"; 152: } 153: ibase_free_result($sel); 154: if(!($sel = ibase_query( 155: "select iter from test7 where v_numeric[$iter] = ?", $v_numeric[$iter])) || 156: !ibase_fetch_row($sel)) { 157: echo "NUMERIC fail\n"; 158: } 159: ibase_free_result($sel); 160: if(!($sel = ibase_query( 161: "select iter from test7 where v_smallint[$iter] = ?", $v_smallint[$iter])) || 162: !ibase_fetch_row($sel)) { 163: echo "SMALLINT fail\n"; 164: } 165: ibase_free_result($sel); 166: } 167: ibase_close(); 168: echo "end of test\n"; 169: ?> 170:
Report
==15755== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
==15755== at 0xD1E0AFC: send (in /lib64/libc-2.12.so)
==15755== by 0x6162227: ??? (in /usr/lib64/libfbclient.so.2.5.7)
==15755== by 0x61624DE: ??? (in /usr/lib64/libfbclient.so.2.5.7)
==15755== by 0x615723A: ??? (in /usr/lib64/libfbclient.so.2.5.7)
==15755== by 0x6157C25: ??? (in /usr/lib64/libfbclient.so.2.5.7)
==15755== by 0x6160747: ??? (in /usr/lib64/libfbclient.so.2.5.7)
==15755== by 0x613CCFB: isc_put_slice (in /usr/lib64/libfbclient.so.2.5.7)
==15755== by 0x614FF84: isc_array_put_slice (in /usr/lib64/libfbclient.so.2.5.7)
==15755== by 0x9140BC: _php_ibase_bind (ibase_query.c:789)
==15755== by 0x915256: _php_ibase_exec (ibase_query.c:975)
==15755== by 0x9160AB: zif_ibase_query (ibase_query.c:1175)
==15755== by 0x135A007: ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:643)
==15755== by 0x135A007: execute_ex (zend_vm_execute.h:54799)
==15755== Address 0x4133093 is in a rw- anonymous segment
==15755==
==15755== Invalid read of size 4
==15755== at 0x6149A82: ??? (in /usr/lib64/libfbclient.so.2.5.7)
==15755== by 0x613B759: isc_database_info (in /usr/lib64/libfbclient.so.2.5.7)
==15755== by 0x91155C: _php_ibase_free_stmt_handle (ibase_query.c:127)
==15755== by 0x91169B: _php_ibase_free_result (ibase_query.c:148)
==15755== by 0x1179F36: zend_resource_dtor (zend_list.c:76)
==15755== by 0x117A95D: zend_close_rsrc (zend_list.c:230)
==15755== by 0x116F80F: zend_hash_reverse_apply (zend_hash.c:1700)
==15755== by 0x117A9A9: zend_close_rsrc_list (zend_list.c:238)
==15755== by 0x110215A: shutdown_executor (zend_execute_API.c:262)
==15755== by 0x1137FC8: zend_deactivate (zend.c:1106)
==15755== by 0x10266CA: php_request_shutdown (main.c:1765)
==15755== by 0x1388C1B: do_cli (php_cli.c:1178)
==15755== Address 0x14f06b80 is 0 bytes inside a block of size 32 free'd
==15755== at 0x4C28BD4: free (vg_replace_malloc.c:529)
==15755== by 0x10C8A2E: _efree (zend_alloc.c:2494)
==15755== by 0x90D8F3: _php_ibase_close_link (interbase.c:643)
==15755== by 0x1179F36: zend_resource_dtor (zend_list.c:76)
==15755== by 0x117A019: zend_list_close (zend_list.c:89)
==15755== by 0x90FADF: zif_ibase_close (interbase.c:1070)
==15755== by 0x135A007: ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:643)
==15755== by 0x135A007: execute_ex (zend_vm_execute.h:54799)
==15755== by 0x1381EB3: zend_execute (zend_vm_execute.h:59987)
==15755== by 0x1139F02: zend_execute_scripts (zend.c:1566)
==15755== by 0x1028AD1: php_execute_script (main.c:2467)
==15755== by 0x1387A92: do_cli (php_cli.c:1011)
==15755== by 0x1389550: main (php_cli.c:1404)
==15755== Block was alloc'd at
==15755== at 0x4C291FA: malloc (vg_replace_malloc.c:298)
==15755== by 0x10CC64D: __zend_malloc (zend_alloc.c:2886)
==15755== by 0x10C37C8: _emalloc_32 (zend_alloc.c:2407)
==15755== by 0x90F36A: _php_ibase_connect (interbase.c:991)
==15755== by 0x90F926: zif_ibase_connect (interbase.c:1035)
==15755== by 0x135A007: ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:643)
==15755== by 0x135A007: execute_ex (zend_vm_execute.h:54799)
==15755== by 0x1381EB3: zend_execute (zend_vm_execute.h:59987)
==15755== by 0x1139F02: zend_execute_scripts (zend.c:1566)
==15755== by 0x1028AD1: php_execute_script (main.c:2467)
==15755== by 0x1387A92: do_cli (php_cli.c:1011)
==15755== by 0x1389550: main (php_cli.c:1404)
==15755==
Generated at Thu, 19 Apr 2018 02:25:01 +0000 (11 hours ago)
|