Mailing List Archive

Boldify deref's a NULL ptr and do we need bold fonts?
Hi,

It is possible, when selecting fonts from the Edit->Preferences->GUI item
to select a font size and not a font.

boldify (at about line 1414 in gtk/main.c) then dereferences a NULL pointer
and core dumps ...

In anycase, since we seem not to need bold fonts any more, is there any
need for the check for bold fonts?

Regards
-------
Richard Sharpe, sharpe@ns.aus.com
Samba (Team member, www.samba.org), Ethereal (Team member, www.zing.org)
Contributing author, SAMS Teach Yourself Samba in 24 Hours
Author, Special Edition, Using Samba
Re: Boldify deref's a NULL ptr and do we need bold fonts? [ In reply to ]
On Mon, Oct 09, 2000 at 12:18:00AM +0900, Richard Sharpe wrote:
> In anycase, since we seem not to need bold fonts any more, is there any
> need for the check for bold fonts?

We don't need bold fonts, but users may still prefer boldface rather
than inverse-video as the indication of the bytes that are part of the
currently selected field.

Either boldface or inverse-video is OK with me, so I wouldn't personally
mind if we eliminated support for boldfacing - it would simplify the
code - but I can't speak for other users.

We should, however, consider changing the setting to inverse-video if
the users selects a font without a matching boldface font, rather than
rejecting the user's choice. (Perhaps we should pop up a warning dialog
box if we're doing so, letting the user click "OK" to accept that and
"Cancel" to reject that and choose a different font.)
Re: Boldify deref's a NULL ptr and do we need bold fonts? [ In reply to ]
On Mon, Oct 09, 2000 at 12:18:00AM +0900, Richard Sharpe wrote:
> It is possible, when selecting fonts from the Edit->Preferences->GUI item
> to select a font size and not a font.
>
> boldify (at about line 1414 in gtk/main.c) then dereferences a NULL pointer
> and core dumps ...

The only calls to "boldify()" in "gtk/gui_prefs.c" are one that passes
it the result of a "g_strdup()" of the result of
"gtk_font_selection_dialog_get_font_name()"; "g_strdup()" will return
NULL if it's handed NULL as an argument.

If that's where it blows up, then we need to check for a null
"font_name" value, and pop up a dialog box telling the user that they
haven't selected a font - if we skip the call to "boldify()", that'll
keep it from blowing up in "boldify()", but it'll just blow up later.

How do you arrange to select a font size and not a font? I tried
un-selecting the font by clicking on the selected font, but I couldn't
reproduce the problem.
Re: Boldify deref's a NULL ptr and do we need bold fonts? [ In reply to ]
On Sun, Oct 08, 2000 at 10:08:21PM -0700, Guy Harris wrote:
> How do you arrange to select a font size and not a font? I tried
> un-selecting the font by clicking on the selected font, but I couldn't
> reproduce the problem.

You have to start Ethereal with the right font; if you do, the GTK+ font
selection dialog can't figure out what font it is, and doesn't start out
with any font selected. "9x15" worked.

I've checked in a fix - the user is now told "You have not selected a
font." and the font selection dialog stays up.