Skip Menu |
 
Update: The rt.cpan.org bug tracker service is no longer shutting down.

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 112427
Status: open
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: fibich [...] technikum-wien.at
Cc: CAC [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



MIME-Version: 1.0
X-Spam-Status: No, score=-1.901 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RP_MATCHES_RCVD=-0.001] autolearn=ham
X-Spam-Flag: NO
X-Virus-Checked: Checked
Content-Type: multipart/signed; boundary="------------ms000609050806060807060803"; micalg="sha1"; protocol="application/pkcs7-signature"
Message-ID: <56CF2711.8070507 [...] technikum-wien.at>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Virus-Scanned: Debian amavisd-new at polyxena.technikum-wien.at
X-Spam-Score: -1.901
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 196812403A7 for <cpan-bug+Tk [...] hipster.bestpractical.com>; Thu, 25 Feb 2016 11:09:25 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id or4ESe+Lvulv for <cpan-bug+Tk [...] hipster.bestpractical.com>; Thu, 25 Feb 2016 11:09:23 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 9FF0924023A for <bug-Tk [...] rt.cpan.org>; Thu, 25 Feb 2016 11:09:22 -0500 (EST)
Received: (qmail 30740 invoked by alias); 25 Feb 2016 16:09:21 -0000
Received: from mail.technikum-wien.at (HELO polyxena.technikum-wien.at) (195.245.225.22) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Thu, 25 Feb 2016 08:08:55 -0800
Received: from localhost (localhost [127.0.0.1]) by polyxena.technikum-wien.at (Postfix) with ESMTP id C276E4E19B2 for <bug-Tk [...] rt.cpan.org>; Thu, 25 Feb 2016 17:08:50 +0100 (CET)
Received: from mail.technikum-wien.at ([127.0.0.1]) by localhost (polyxena.technikum-wien.at [127.0.0.1]) (amavisd-new, port 10124) with ESMTP id POe2dwKyFrKt for <bug-Tk [...] rt.cpan.org>; Thu, 25 Feb 2016 17:08:49 +0100 (CET)
Received: from [10.4.56.33] (unknown [10.4.56.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.technikum-wien.at (Postfix) with ESMTPSA for <bug-Tk [...] rt.cpan.org>; Thu, 25 Feb 2016 17:08:49 +0100 (CET)
Delivered-To: cpan-bug+Tk [...] hipster.bestpractical.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0
Subject: Invalid write when grep used in Tk::Entry validatecommand
Return-Path: <fibich [...] technikum-wien.at>
X-RT-Mail-Extension: tk
X-Original-To: cpan-bug+Tk [...] hipster.bestpractical.com
X-Spam-Check-BY: la.mx.develooper.com
Date: Thu, 25 Feb 2016 17:08:49 +0100
X-Spam-Level:
To: bug-Tk [...] rt.cpan.org
From: Christian Fibich <fibich [...] technikum-wien.at>
X-RT-Interface: Email
Content-Length: 0
content-type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: quoted-printable
X-RT-Original-Encoding: utf-8
Content-Length: 4073
Download (untitled) / with headers
text/plain 3.9k
Hi, We are currently developing a Perl/Tk application, which crashes with a "malloc(): memory corruption" error when a specific button is pressed. This button sets the value of an Entry widget's textvariable, which is then validated against a list using grep(). When running with valgrind, this button press causes an "Invalid Write" in already freed memory. I've narrowed it down to the following code, which does not crash but results in the same memory error being reported by valgrind: ======================================================================== use Tk; use strict; use warnings; use constant MAX => 330; my $listref = []; for (my $i = 0; $i < MAX; $i++) { push @{$listref}, "string $i"; } my $mw = MainWindow->new; my $tv = "Original"; my $fr = $mw->Frame()->pack; my $entry = $fr->Entry(-textvariable=>\$tv)->pack; $fr->Button(-text=>'Button',-command=>sub{$tv = "string 4";})->pack; $entry->configure(-validate=>'key', -validatecommand=>[\&test, $listref]); MainLoop; sub test { my ($listref, $new) = @_; my $num = grep (/^\Q$new\E/, @{$listref}); return $num == 1; } ======================================================================== This is the error valgrind reports: ==11007== Invalid write of size 8 ==11007== at 0x4B6C1D: Perl_pp_sassign (pp_hot.c:232) ==11007== by 0x4B6595: Perl_runops_standard (run.c:41) ==11007== by 0x43C4ED: Perl_call_sv (perl.c:2774) ==11007== by 0x5F40180: LangCallCallback (pTkCallback.c:200) ==11007== by 0x6D998E8: Tcl_EvalObjEx (tkGlue.c:4349) ==11007== by 0x6DB32CB: ButtonWidgetObjCmd (tkButton.c:890) ==11007== by 0x6D9441D: Call_Tk (tkGlue.c:2260) ==11007== by 0x6D887E3: XS_Tk_WidgetMethod (Tk.xs:488) ==11007== by 0x4BD6F9: Perl_pp_entersub (pp_hot.c:3270) ==11007== by 0x4B6595: Perl_runops_standard (run.c:41) ==11007== by 0x43C4ED: Perl_call_sv (perl.c:2774) ==11007== by 0x5F401B9: LangCallCallback (pTkCallback.c:215) ==11007== Address 0x67db0b8 is 8 bytes inside a block of size 2,672 free'd ==11007== at 0x4C2BE1F: realloc (vg_replace_malloc.c:785) ==11007== by 0x4989C9: Perl_safesysrealloc (util.c:270) ==11007== by 0x4B4C81: Perl_av_extend_guts (av.c:159) ==11007== by 0x4EFAB2: Perl_stack_grow (scope.c:36) ==11007== by 0x4BE0C7: Perl_pp_padsv (pp_hot.c:402) ==11007== by 0x4B6595: Perl_runops_standard (run.c:41) ==11007== by 0x43C4ED: Perl_call_sv (perl.c:2774) ==11007== by 0x5F40180: LangCallCallback (pTkCallback.c:200) ==11007== by 0x6D9525D: LangDoCallback (tkGlue.c:1925) ==11007== by 0x952377E: EntryValidateChange (tkEntry.c:3483) ==11007== by 0x9524D01: EntrySetValue (tkEntry.c:2536) ==11007== by 0x952500E: EntryTextVarProc (tkEntry.c:3350) ==11007== Block was alloc'd at ==11007== at 0x4C2BE1F: realloc (vg_replace_malloc.c:785) ==11007== by 0x4989C9: Perl_safesysrealloc (util.c:270) ==11007== by 0x4B4C81: Perl_av_extend_guts (av.c:159) ==11007== by 0x4EFAB2: Perl_stack_grow (scope.c:36) ==11007== by 0x4B6797: Perl_pp_const (pp_hot.c:43) ==11007== by 0x4B6595: Perl_runops_standard (run.c:41) ==11007== by 0x43C4ED: Perl_call_sv (perl.c:2774) ==11007== by 0x43E78A: Perl_call_list (perl.c:4943) ==11007== by 0x41D858: S_process_special_blocks (op.c:8891) ==11007== by 0x434E09: Perl_newATTRSUB_x (op.c:8820) ==11007== by 0x438AF3: Perl_utilize (op.c:6043) ==11007== by 0x46CFD3: Perl_yyparse (perly.y:351) ==11007== I am using Perl 5.22.1 x86_64-linux-thread-multi and Tk 804.033 (from Debian Testing). Similar errors are reported by valgrind (however, starting at different minimum values of MAX) under: * Perl 5.10.1 i386-linux-thread-multi and Tk 804.02853 (from CentOS) * Perl 5.18.4 x86_64-linux-thread-multi and Tk 804.031 (from Fedora 21) -- Christian Fibich, MSc Research and Development Department of Embedded Systems University of Applied Sciences Technikum Wien Hoechstaedtplatz 6, 1200 Vienna, Austria T: +43 1 3334077-303 E: christian.fibich@technikum-wien.at I: embsys.technikum-wien.at I: www.technikum-wien.at
Content-Description: S/MIME Cryptographic Signature
Content-Type: application/pkcs7-signature; name="smime.p7s"
Content-Disposition: attachment; filename="smime.p7s"
Content-Transfer-Encoding: base64
Content-Length: 2042
Download smime.p7s
application/pkcs7-signature 1.9k

Message body not shown because it is not plain text.

MIME-Version: 1.0
In-Reply-To: <56CF2711.8070507 [...] technikum-wien.at>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <56CF2711.8070507 [...] technikum-wien.at>
Content-Type: text/html; charset="utf-8"
Message-ID: <rt-4.0.18-11852-1592696413-217.112427-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 316
I can reproduce the "Invalid write" reported by Valgrind using MAX = 331 on Debian 10 amd64, Perl 5.28.1, Perl/Tk 084.035. This seems to be specific to Perl and/or Perl/Tk; I do not observe the issue when running the example under recent Tcl/Tk using Tcl::pTk::TkHijack, even for much larger values of MAX.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.