FLTK logo

STR #70

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Roadmap 1.1 | SVN ⇄ GIT ]

STR #70

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:5 - Critical, e.g. nothing working at all
Scope:3 - Applies to all machines and operating systems
Subsystem:Core Library
Summary:Fl::event_text() uninitialized crashes application
Version:1.1.4rc1
Created By:AlbrechtS
Assigned To:mike
Fix Version:1.1.4
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:


Name/Time/Date Filename/Size  
 
#1 mike
21:27 Jun 14, 2003
str70.patch
2k
 
     

Trouble Report Comments:


Name/Time/Date Text  
 
#1 AlbrechtS
06:18 Jun 06, 2003
Fltk 1.1.4rc1 (cvs) and Fltk 1.1.2,
crashes found under windows and linux (1.1.4rc1/cvs).

I found that Fl::event_text() may not be initialized to any useful
value, and applications crash, when it is referenced in a way like
Fl::event_text()[0], before some text operations have been done.

You can see this effect with the Tabs test program:

- start tabs
- click the middle mouse button in any input field (no text will be
  inserted)
- click button1 (or any other tab)

This is the call stack:

navkey() line 110 + 5 bytes
Fl_Group::handle(int 0x00000006) line 129 + 5 bytes
Fl_Window::handle(int 0x00000006) line 851
Fl_Widget::take_focus() line 119 + 13 bytes
fl_fix_focus() line 488 + 8 bytes
Fl::handle(int 0x00000006, Fl_Window * 0x00ca1ae0) line 652
WndProc(void * 0x00000e28, unsigned int 0x00000007, unsigned int
0x00000b7c, long 0x00000000) line 649 + 11 bytes
KERNEL32! bff7363b()
KERNEL32! bff942e7()

Fl_Group::navkey() uses:

    switch (Fl::event_text()[0]) { ...

I'm not sure, why event_text() (aka Fl::e_text) is not initialized
correctly, because there is an initialization in Fl.cxx:

Fl.cxx:char             *Fl::e_text = (char *)"";

but this is from Fl.H:

../FL/Fl.H:  static char* e_text;
../FL/Fl.H:  static const char* event_text() {return e_text;}


So, what's wrong here? Should all references to Fl::event_text() check
the pointer before using it, or can it be initialized to a null string,
as it seems to be intended in Fl.cxx?

Albrecht Schloßer
 
 
#2 mike
16:19 Jun 11, 2003
Looking into it...  e_text gets updated on-the-fly, so we just need to make sure it isn't initialized to NULL...  
 
#3 mike
21:27 Jun 14, 2003
Fixed in CVS; see the attached patch...  
     

Return to Bugs & Features ]

 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.