PHP  
 PHP_7_2
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Valgrind Report for ext/interbase/tests/004.phpt ('InterBase: BLOB test')

Script

1: <?php
2:
3:     
require("interbase.inc");
4:     
5:     
$link ibase_connect($test_base);
6:
7:     
ibase_query(
8:         
"CREATE TABLE test4 (
9:             v_integer   integer,
10:             v_blob        blob)"
);
11:     
ibase_commit();
12:
13:     
/* create 100k blob file  */
14:     
$blob_str rand_binstr(100*1024);
15:
16:     
$name tempnam(dirname(__FILE__),"blob.tmp");
17:     
$ftmp fopen($name,"w");
18:     
fwrite($ftmp,$blob_str);
19:     
fclose($ftmp);
20:
21:     echo 
"import blob 1\n";
22:     
$ftmp fopen($name,"r");
23:     
$bl_s ibase_blob_import($ftmp);
24:     
ibase_query("INSERT INTO test4 (v_integer, v_blob) VALUES (1, ?)"$bl_s);
25:
26:     
$bl_s ibase_blob_import($link,$ftmp);
27:     
ibase_query($link"INSERT INTO test4 (v_integer, v_blob) VALUES (1, ?)"$bl_s);
28:     
fclose($ftmp);
29:
30:     echo 
"test blob 1\n";
31:     
$q ibase_query("SELECT v_blob FROM test4 WHERE v_integer = 1");
32:
33:     
$row ibase_fetch_object($q);
34:     
$bl_h ibase_blob_open($row->V_BLOB);
35:
36:     
$blob '';    
37:     while(
$piece ibase_blob_get($bl_hrand() % 1024))
38:         
$blob .= $piece;
39:     if(
$blob != $blob_str)
40:         echo 
" BLOB 1 fail (1)\n";
41:     
ibase_blob_close($bl_h);
42:
43:     
$bl_h ibase_blob_open($link,$row->V_BLOB);
44:
45:     
$blob '';    
46:     while(
$piece ibase_blob_get($bl_h100 1024))
47:         
$blob .= $piece;
48:     if(
$blob != $blob_str)
49:         echo 
" BLOB 1 fail (2)\n";
50:     
ibase_blob_close($bl_h);
51:     
ibase_free_result($q);
52:     unset(
$blob);
53:
54:     echo 
"create blob 2\n";
55:
56:     
ibase_query("INSERT INTO test4 (v_integer, v_blob) VALUES (2, ?)"$blob_str);
57:
58:     echo 
"test blob 2\n";
59:
60:     
$q ibase_query("SELECT v_blob FROM test4 WHERE v_integer = 2");
61:     
$row ibase_fetch_object($q,IBASE_TEXT);
62:
63:     if(
$row->V_BLOB != $blob_str)
64:         echo 
" BLOB 2 fail\n";
65:     
ibase_free_result($q);
66:     unset(
$blob);
67:
68:
69:     echo 
"create blob 3\n";
70:
71:     
$bl_h ibase_blob_create($link);
72:
73:     
ibase_blob_add($bl_h"+----------------------------------------------------------------------+\n");
74:     
ibase_blob_add($bl_h"| PHP HTML Embedded Scripting Language Version 3.0                     |\n");
75:     
ibase_blob_add($bl_h"+----------------------------------------------------------------------+\n");
76:     
ibase_blob_add($bl_h"| Copyright (c) 1997-2000 PHP Development Team (See Credits file)      |\n");
77:     
ibase_blob_add($bl_h"+----------------------------------------------------------------------+\n");
78:     
ibase_blob_add($bl_h"| This program is free software; you can redistribute it and/or modify |\n");
79:     
ibase_blob_add($bl_h"| it under the terms of one of the following licenses:                 |\n");
80:     
ibase_blob_add($bl_h"|                                                                      |\n");
81:     
ibase_blob_add($bl_h"|  A) the GNU General Public License as published by the Free Software |\n");
82:     
ibase_blob_add($bl_h"|     Foundation; either version 2 of the License, or (at your option) |\n");
83:     
ibase_blob_add($bl_h"|     any later version.                                               |\n");
84:     
ibase_blob_add($bl_h"|                                                                      |\n");
85:     
ibase_blob_add($bl_h"|  B) the PHP License as published by the PHP Development Team and     |\n");
86:     
ibase_blob_add($bl_h"|     included in the distribution in the file: LICENSE                |\n");
87:     
ibase_blob_add($bl_h"|                                                                      |\n");
88:     
ibase_blob_add($bl_h"| This program is distributed in the hope that it will be useful,      |\n");
89:     
ibase_blob_add($bl_h"| but WITHOUT ANY WARRANTY; without even the implied warranty of       |\n");
90:     
ibase_blob_add($bl_h"| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        |\n");
91:     
ibase_blob_add($bl_h"| GNU General Public License for more details.                         |\n");
92:     
ibase_blob_add($bl_h"|                                                                      |\n");
93:     
ibase_blob_add($bl_h"| You should have received a copy of both licenses referred to here.   |\n");
94:     
ibase_blob_add($bl_h"| If you did not, or have any questions about PHP licensing, please    |\n");
95:     
ibase_blob_add($bl_h"| contact core@php.net.                                                |\n");
96:     
ibase_blob_add($bl_h"+----------------------------------------------------------------------+\n");
97:     
$bl_s ibase_blob_close($bl_h);
98:     
ibase_query("INSERT INTO test4 (v_integer, v_blob) VALUES (3, ?)"$bl_s);
99:     
ibase_commit();
100:     echo 
"echo blob 3\n";
101:
102:     
$q ibase_query("SELECT v_blob FROM test4 WHERE v_integer = 3");
103:     
$row ibase_fetch_object($q);
104:     
ibase_commit();
105:     
ibase_close();
106:         
107:     
$link ibase_connect($test_base);
108:     
ibase_blob_echo($link$row->V_BLOB);
109:     
ibase_free_result($q);
110:
111:     echo 
"fetch blob 3\n";
112:     
$q ibase_query("SELECT v_blob FROM test4 WHERE v_integer = 3");
113:     
$row ibase_fetch_object($q,IBASE_TEXT);
114:     echo 
$row->V_BLOB;
115:     
ibase_free_result($q);
116:
117:     
ibase_close();
118:     
unlink($name);
119:     echo 
"end of test\n";
120:
?>
121:

Report

==21483== Invalid read of size 4
==21483==    at 0x5F3DA82: ??? (in /usr/lib64/libfbclient.so.2.5.7)
==21483==    by 0x5F2F759: isc_database_info (in /usr/lib64/libfbclient.so.2.5.7)
==21483==    by 0x8E430A: _php_ibase_free_stmt_handle (ibase_query.c:127)
==21483==    by 0x8E4442: _php_ibase_free_result (ibase_query.c:148)
==21483==    by 0x112330D: zend_resource_dtor (zend_list.c:76)
==21483==    by 0x1123A91: list_entry_destructor (zend_list.c:187)
==21483==    by 0x111513B: _zend_hash_del_el_ex (zend_hash.c:996)
==21483==    by 0x111513B: zend_hash_index_del (zend_hash.c:1209)
==21483==    by 0x11231F3: zend_list_free (zend_list.c:59)
==21483==    by 0x10D93CA: _zval_dtor_func (zend_variables.c:63)
==21483==    by 0x12C3713: zend_assign_to_variable (zend_execute.h:106)
==21483==    by 0x12C3713: ZEND_ASSIGN_SPEC_CV_VAR_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:39072)
==21483==    by 0x133C718: execute_ex (zend_vm_execute.h:59726)
==21483==    by 0x133CD90: zend_execute (zend_vm_execute.h:63763)
==21483==  Address 0x14f54c80 is 0 bytes inside a block of size 32 free'd
==21483==    at 0x4C28BD4: free (vg_replace_malloc.c:529)
==21483==    by 0x1078165: _efree (zend_alloc.c:2444)
==21483==    by 0x8E06D8: _php_ibase_close_link (interbase.c:643)
==21483==    by 0x112330D: zend_resource_dtor (zend_list.c:76)
==21483==    by 0x11233E5: zend_list_close (zend_list.c:89)
==21483==    by 0x8E29A7: zif_ibase_close (interbase.c:1072)
==21483==    by 0x11C032A: ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:573)
==21483==    by 0x133C718: execute_ex (zend_vm_execute.h:59726)
==21483==    by 0x133CD90: zend_execute (zend_vm_execute.h:63763)
==21483==    by 0x10E180E: zend_execute_scripts (zend.c:1496)
==21483==    by 0xFD3164: php_execute_script (main.c:2590)
==21483==    by 0x134292D: do_cli (php_cli.c:1011)
==21483==  Block was alloc'd at
==21483==    at 0x4C291FA: malloc (vg_replace_malloc.c:298)
==21483==    by 0x1079747: __zend_malloc (zend_alloc.c:2829)
==21483==    by 0x1072F1A: _emalloc_32 (zend_alloc.c:2352)
==21483==    by 0x8E21C6: _php_ibase_connect (interbase.c:988)
==21483==    by 0x8E27EB: zif_ibase_connect (interbase.c:1037)
==21483==    by 0x11C0812: ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER (zend_vm_execute.h:617)
==21483==    by 0x133C718: execute_ex (zend_vm_execute.h:59726)
==21483==    by 0x133CD90: zend_execute (zend_vm_execute.h:63763)
==21483==    by 0x10E180E: zend_execute_scripts (zend.c:1496)
==21483==    by 0xFD3164: php_execute_script (main.c:2590)
==21483==    by 0x134292D: do_cli (php_cli.c:1011)
==21483==    by 0x13442E1: main (php_cli.c:1404)
==21483== 

 

Generated at Sat, 09 Dec 2017 10:21:20 +0000 (2 days ago)

Copyright © 2005-2017 The PHP Group
All rights reserved.