* Problem report #27
@ 2006-04-10 19:01 Dan Nicolaescu
2006-04-11 7:00 ` Jan D.
0 siblings, 1 reply; 2+ messages in thread
From: Dan Nicolaescu @ 2006-04-10 19:01 UTC (permalink / raw)
CID: 27
Checker: FORWARD_NULL (help)
File: emacs/src/xmenu.c
Function: xmenu_show
Description: Variable "save_wv" tracked as NULL was dereferenced.
Event assign_zero: Variable "save_wv" assigned value 0.
Also see events: [var_deref_op]
2668 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
2669 widget_value **submenu_stack
2670 = (widget_value **) alloca (menu_items_used * sizeof (widget_value *));
2671 Lisp_Object *subprefix_stack
2672 = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object));
2673 int submenu_depth = 0;
2674
2675 int first_pane;
2676
2677 *error = NULL;
2678
2679 if (menu_items_used <= MENU_ITEMS_PANE_LENGTH)
2680 {
2681 *error = "Empty menu";
2682 return Qnil;
2683 }
2684
2685 /* Create a tree of widget_value objects
2686 representing the panes and their items. */
2687 wv = xmalloc_widget_value ();
2688 wv->name = "menu";
2689 wv->value = 0;
2690 wv->enabled = 1;
2691 wv->button_type = BUTTON_TYPE_NONE;
2692 wv->help =Qnil;
2693 first_wv = wv;
2694 first_pane = 1;
2695
2696 /* Loop over all panes and items, filling in the tree. */
2697 i = 0;
At conditional (1): "i < menu_items_used" taking true path
At conditional (7): "i < menu_items_used" taking true path
2698 while (i < menu_items_used)
2699 {
At conditional (2): "((0), (menu_items & -8))->contents[i] == Qnil" taking false path
At conditional (8): "((0), (menu_items & -8))->contents[i] == Qnil" taking false path
2700 if (EQ (XVECTOR (menu_items)->contents[i], Qnil))
2701 {
2702 submenu_stack[submenu_depth++] = save_wv;
2703 save_wv = prev_wv;
2704 prev_wv = 0;
2705 first_pane = 1;
2706 i++;
2707 }
At conditional (3): "((0), (menu_items & -8))->contents[i] == Qlambda" taking false path
At conditional (9): "((0), (menu_items & -8))->contents[i] == Qlambda" taking false path
2708 else if (EQ (XVECTOR (menu_items)->contents[i], Qlambda))
2709 {
2710 prev_wv = save_wv;
2711 save_wv = submenu_stack[--submenu_depth];
2712 first_pane = 0;
2713 i++;
2714 }
At conditional (4): "((0), (menu_items & -8))->contents[i] == Qt" taking true path
At conditional (5): "submenu_depth != 0" taking false path
At conditional (10): "((0), (menu_items & -8))->contents[i] == Qt" taking false path
2715 else if (EQ (XVECTOR (menu_items)->contents[i], Qt)
2716 && submenu_depth != 0)
2717 i += MENU_ITEMS_PANE_LENGTH;
2718 /* Ignore a nil in the item list.
2719 It's meaningful only for dialog boxes. */
At conditional (6): "((0), (menu_items & -8))->contents[i] == Qquote" taking true path
At conditional (11): "((0), (menu_items & -8))->contents[i] == Qquote" taking false path
2720 else if (EQ (XVECTOR (menu_items)->contents[i], Qquote))
2721 i += 1;
At conditional (12): "((0), (menu_items & -8))->contents[i] == Qt" taking false path
2722 else if (EQ (XVECTOR (menu_items)->contents[i], Qt))
2723 {
2724 /* Create a new pane. */
2725 Lisp_Object pane_name, prefix;
2726 char *pane_string;
2727
2728 pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
2729 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
2730
2731 #ifndef HAVE_MULTILINGUAL_MENU
2732 if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
2733 {
2734 pane_name = ENCODE_MENU_STRING (pane_name);
2735 AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name;
2736 }
2737 #endif
2738 pane_string = (NILP (pane_name)
2739 ? "" : (char *) SDATA (pane_name));
2740 /* If there is just one top-level pane, put all its items directly
2741 under the top-level menu. */
2742 if (menu_items_n_panes == 1)
2743 pane_string = "";
2744
2745 /* If the pane has a meaningful name,
2746 make the pane a top-level menu item
2747 with its items as a submenu beneath it. */
2748 if (!keymaps && strcmp (pane_string, ""))
2749 {
2750 wv = xmalloc_widget_value ();
2751 if (save_wv)
2752 save_wv->next = wv;
2753 else
2754 first_wv->contents = wv;
2755 wv->name = pane_string;
2756 if (keymaps && !NILP (prefix))
2757 wv->name++;
2758 wv->value = 0;
2759 wv->enabled = 1;
2760 wv->button_type = BUTTON_TYPE_NONE;
2761 wv->help = Qnil;
2762 save_wv = wv;
2763 prev_wv = 0;
2764 }
2765 else if (first_pane)
2766 {
2767 save_wv = wv;
2768 prev_wv = 0;
2769 }
2770 first_pane = 0;
2771 i += MENU_ITEMS_PANE_LENGTH;
2772 }
2773 else
2774 {
2775 /* Create a new item within current pane. */
2776 Lisp_Object item_name, enable, descrip, def, type, selected, help;
2777 item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
2778 enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
2779 descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
2780 def = AREF (menu_items, i + MENU_ITEMS_ITEM_DEFINITION);
2781 type = AREF (menu_items, i + MENU_ITEMS_ITEM_TYPE);
2782 selected = AREF (menu_items, i + MENU_ITEMS_ITEM_SELECTED);
2783 help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP);
2784
2785 #ifndef HAVE_MULTILINGUAL_MENU
At conditional (13): "item_name & 7 == 3" taking true path
At conditional (14): "((0), (item_name & -8))->size_byte >= 0" taking true path
2786 if (STRINGP (item_name) && STRING_MULTIBYTE (item_name))
2787 {
At conditional (15): "Vlocale_coding_system != Qnil" taking true path
At conditional (16): "Vlocale_coding_system != 0" taking true path
2788 item_name = ENCODE_MENU_STRING (item_name);
2789 AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
2790 }
2791
At conditional (17): "descrip & 7 == 3" taking true path
At conditional (18): "((0), (descrip & -8))->size_byte >= 0" taking true path
2792 if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
2793 {
At conditional (19): "Vlocale_coding_system != Qnil" taking true path
At conditional (20): "Vlocale_coding_system != 0" taking true path
2794 descrip = ENCODE_MENU_STRING (descrip);
2795 AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
2796 }
2797 #endif /* not HAVE_MULTILINGUAL_MENU */
2798
2799 wv = xmalloc_widget_value ();
At conditional (21): "prev_wv != 0" taking false path
2800 if (prev_wv)
2801 prev_wv->next = wv;
2802 else
Event var_deref_op: Variable "save_wv" tracked as NULL was dereferenced.
Also see events: [assign_zero]
2803 save_wv->contents = wv;
2804 wv->name = (char *) SDATA (item_name);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Problem report #27
2006-04-10 19:01 Problem report #27 Dan Nicolaescu
@ 2006-04-11 7:00 ` Jan D.
0 siblings, 0 replies; 2+ messages in thread
From: Jan D. @ 2006-04-11 7:00 UTC (permalink / raw)
#18 once more.
Jan D.
Dan Nicolaescu wrote:
> CID: 27
> Checker: FORWARD_NULL (help)
> File: emacs/src/xmenu.c
> Function: xmenu_show
> Description: Variable "save_wv" tracked as NULL was dereferenced.
>
> Event assign_zero: Variable "save_wv" assigned value 0.
> Also see events: [var_deref_op]
>
> 2668 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
> 2669 widget_value **submenu_stack
> 2670 = (widget_value **) alloca (menu_items_used * sizeof (widget_value *));
> 2671 Lisp_Object *subprefix_stack
> 2672 = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object));
> 2673 int submenu_depth = 0;
> 2674
> 2675 int first_pane;
> 2676
> 2677 *error = NULL;
> 2678
> 2679 if (menu_items_used <= MENU_ITEMS_PANE_LENGTH)
> 2680 {
> 2681 *error = "Empty menu";
> 2682 return Qnil;
> 2683 }
> 2684
> 2685 /* Create a tree of widget_value objects
> 2686 representing the panes and their items. */
> 2687 wv = xmalloc_widget_value ();
> 2688 wv->name = "menu";
> 2689 wv->value = 0;
> 2690 wv->enabled = 1;
> 2691 wv->button_type = BUTTON_TYPE_NONE;
> 2692 wv->help =Qnil;
> 2693 first_wv = wv;
> 2694 first_pane = 1;
> 2695
> 2696 /* Loop over all panes and items, filling in the tree. */
> 2697 i = 0;
>
> At conditional (1): "i < menu_items_used" taking true path
> At conditional (7): "i < menu_items_used" taking true path
>
> 2698 while (i < menu_items_used)
> 2699 {
>
> At conditional (2): "((0), (menu_items & -8))->contents[i] == Qnil" taking false path
> At conditional (8): "((0), (menu_items & -8))->contents[i] == Qnil" taking false path
>
> 2700 if (EQ (XVECTOR (menu_items)->contents[i], Qnil))
> 2701 {
> 2702 submenu_stack[submenu_depth++] = save_wv;
> 2703 save_wv = prev_wv;
> 2704 prev_wv = 0;
> 2705 first_pane = 1;
> 2706 i++;
> 2707 }
>
> At conditional (3): "((0), (menu_items & -8))->contents[i] == Qlambda" taking false path
> At conditional (9): "((0), (menu_items & -8))->contents[i] == Qlambda" taking false path
>
> 2708 else if (EQ (XVECTOR (menu_items)->contents[i], Qlambda))
> 2709 {
> 2710 prev_wv = save_wv;
> 2711 save_wv = submenu_stack[--submenu_depth];
> 2712 first_pane = 0;
> 2713 i++;
> 2714 }
>
> At conditional (4): "((0), (menu_items & -8))->contents[i] == Qt" taking true path
> At conditional (5): "submenu_depth != 0" taking false path
> At conditional (10): "((0), (menu_items & -8))->contents[i] == Qt" taking false path
>
> 2715 else if (EQ (XVECTOR (menu_items)->contents[i], Qt)
> 2716 && submenu_depth != 0)
> 2717 i += MENU_ITEMS_PANE_LENGTH;
> 2718 /* Ignore a nil in the item list.
> 2719 It's meaningful only for dialog boxes. */
>
> At conditional (6): "((0), (menu_items & -8))->contents[i] == Qquote" taking true path
> At conditional (11): "((0), (menu_items & -8))->contents[i] == Qquote" taking false path
>
> 2720 else if (EQ (XVECTOR (menu_items)->contents[i], Qquote))
> 2721 i += 1;
>
> At conditional (12): "((0), (menu_items & -8))->contents[i] == Qt" taking false path
>
> 2722 else if (EQ (XVECTOR (menu_items)->contents[i], Qt))
> 2723 {
> 2724 /* Create a new pane. */
> 2725 Lisp_Object pane_name, prefix;
> 2726 char *pane_string;
> 2727
> 2728 pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
> 2729 prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
> 2730
> 2731 #ifndef HAVE_MULTILINGUAL_MENU
> 2732 if (STRINGP (pane_name) && STRING_MULTIBYTE (pane_name))
> 2733 {
> 2734 pane_name = ENCODE_MENU_STRING (pane_name);
> 2735 AREF (menu_items, i + MENU_ITEMS_PANE_NAME) = pane_name;
> 2736 }
> 2737 #endif
> 2738 pane_string = (NILP (pane_name)
> 2739 ? "" : (char *) SDATA (pane_name));
> 2740 /* If there is just one top-level pane, put all its items directly
> 2741 under the top-level menu. */
> 2742 if (menu_items_n_panes == 1)
> 2743 pane_string = "";
> 2744
> 2745 /* If the pane has a meaningful name,
> 2746 make the pane a top-level menu item
> 2747 with its items as a submenu beneath it. */
> 2748 if (!keymaps && strcmp (pane_string, ""))
> 2749 {
> 2750 wv = xmalloc_widget_value ();
> 2751 if (save_wv)
> 2752 save_wv->next = wv;
> 2753 else
> 2754 first_wv->contents = wv;
> 2755 wv->name = pane_string;
> 2756 if (keymaps && !NILP (prefix))
> 2757 wv->name++;
> 2758 wv->value = 0;
> 2759 wv->enabled = 1;
> 2760 wv->button_type = BUTTON_TYPE_NONE;
> 2761 wv->help = Qnil;
> 2762 save_wv = wv;
> 2763 prev_wv = 0;
> 2764 }
> 2765 else if (first_pane)
> 2766 {
> 2767 save_wv = wv;
> 2768 prev_wv = 0;
> 2769 }
> 2770 first_pane = 0;
> 2771 i += MENU_ITEMS_PANE_LENGTH;
> 2772 }
> 2773 else
> 2774 {
> 2775 /* Create a new item within current pane. */
> 2776 Lisp_Object item_name, enable, descrip, def, type, selected, help;
> 2777 item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
> 2778 enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
> 2779 descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
> 2780 def = AREF (menu_items, i + MENU_ITEMS_ITEM_DEFINITION);
> 2781 type = AREF (menu_items, i + MENU_ITEMS_ITEM_TYPE);
> 2782 selected = AREF (menu_items, i + MENU_ITEMS_ITEM_SELECTED);
> 2783 help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP);
> 2784
> 2785 #ifndef HAVE_MULTILINGUAL_MENU
>
> At conditional (13): "item_name & 7 == 3" taking true path
> At conditional (14): "((0), (item_name & -8))->size_byte >= 0" taking true path
>
> 2786 if (STRINGP (item_name) && STRING_MULTIBYTE (item_name))
> 2787 {
>
> At conditional (15): "Vlocale_coding_system != Qnil" taking true path
> At conditional (16): "Vlocale_coding_system != 0" taking true path
>
> 2788 item_name = ENCODE_MENU_STRING (item_name);
> 2789 AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
> 2790 }
> 2791
>
> At conditional (17): "descrip & 7 == 3" taking true path
> At conditional (18): "((0), (descrip & -8))->size_byte >= 0" taking true path
>
> 2792 if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
> 2793 {
>
> At conditional (19): "Vlocale_coding_system != Qnil" taking true path
> At conditional (20): "Vlocale_coding_system != 0" taking true path
>
> 2794 descrip = ENCODE_MENU_STRING (descrip);
> 2795 AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
> 2796 }
> 2797 #endif /* not HAVE_MULTILINGUAL_MENU */
> 2798
> 2799 wv = xmalloc_widget_value ();
>
> At conditional (21): "prev_wv != 0" taking false path
>
> 2800 if (prev_wv)
> 2801 prev_wv->next = wv;
> 2802 else
>
> Event var_deref_op: Variable "save_wv" tracked as NULL was dereferenced.
> Also see events: [assign_zero]
>
> 2803 save_wv->contents = wv;
> 2804 wv->name = (char *) SDATA (item_name);
>
>
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-04-11 7:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-10 19:01 Problem report #27 Dan Nicolaescu
2006-04-11 7:00 ` Jan D.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).