Re: [g-a-devel]Re: patch for at-spi/libspi/stateset.c
- From: Bill Haneman <bill haneman sun com>
- To: Radek Doulík <rodo ximian com>
- Cc: gnome-accessibility-devel gnome org
- Subject: Re: [g-a-devel]Re: patch for at-spi/libspi/stateset.c
- Date: 29 Apr 2002 18:28:11 +0100
On Mon, 2002-04-29 at 15:56, Radek Doulík wrote:
> > Hi Radek:
> >
> > Thanks for the patch.
> >
> > I don't believe it's quite correct however...
> No, this is exactly what you want to do, because you use those tables as
> conversion tables and index them by other enum values.
Ah, yes, of course. thanks for catching that.
> > I believe the attached patch will work better. It looks as though the
> > original bug was the result of a bad merge, since the arrays were being
> > allocated twice.
>
> You are right here, I didn't realize those upper allocations, though you
> want to switch sizes.
>
> I hope you will find attached patch correct ;-) (I removed duplicit
> allocations)
Your patch (below) looks correct. Unfortunately I committed my previous
one (which was not correct, as you point out). I have updated the
ChangeLog with your entry and fixed it, but if you prefer to keep the
change attributions correct in the CVS log I could back out the patches
instead, just let me know.
-Bill
> Cheers
> Radek
>
> >
> > Best regards,
> >
> > -Bill
> >
> > > On Pá, 2002-04-26 at 14:02, Radek Doulík wrote:
> > > >
> > > > Hi,
> > > >
> > > > please find attached patch which fixes nasty out of bounds memory access
> > > > in at-spi/libspi/stateset.c.
> > > >
> > > > Cheers
> > > > Radek
> > >
> > > ----
> > >
> >
> > > ? .debug
> > > ? diff
> > > ? registryd/at-spi-registryd
> > > Index: ChangeLog
> > > ===================================================================
> > > RCS file: /cvs/gnome/at-spi/ChangeLog,v
> > > retrieving revision 1.194
> > > diff -u -p -r1.194 ChangeLog
> > > --- ChangeLog 22 Apr 2002 18:29:05 -0000 1.194
> > > +++ ChangeLog 26 Apr 2002 23:56:56 -0000
> > > @@ -1,3 +1,8 @@
> > > +2002-04-26 Radek Doulik <rodo ximian com>
> > > +
> > > + * libspi/stateset.c (spi_init_state_type_tables): fix size of
> > > + atk_state_types table
> > > +
> > > 2002-04-22 jacob berkman <jacob ximian com>
> > >
> > > * util/Makefile.am:
> > > Index: libspi/stateset.c
> > > ===================================================================
> > > RCS file: /cvs/gnome/at-spi/libspi/stateset.c,v
> > > retrieving revision 1.3
> > > diff -u -p -r1.3 stateset.c
> > > --- libspi/stateset.c 13 Apr 2002 20:47:46 -0000 1.3
> > > +++ libspi/stateset.c 26 Apr 2002 23:56:56 -0000
> > > @@ -46,12 +46,15 @@ spi_init_state_type_tables (void)
> > > g_return_val_if_fail (atk_state_types, FALSE);
> > >
> > > accessible_state_types = g_new (Accessibility_StateType, ATK_STATE_LAST_DEFINED);
> > > - atk_state_types = g_new (AtkStateType, ATK_STATE_LAST_DEFINED);
> > > -
> > > for (i = 0; i < ATK_STATE_LAST_DEFINED; i++)
> > > {
> > > - atk_state_types[i] = ATK_STATE_INVALID;
> > > accessible_state_types[i] = Accessibility_STATE_INVALID;
> > > + }
> > > +
> > > + atk_state_types = g_new (AtkStateType, Accessibility_STATE_LAST_DEFINED);
> > > + for (i = 0; i < Accessibility_STATE_LAST_DEFINED; i++)
> > > + {
> > > + atk_state_types[i] = ATK_STATE_INVALID;
> > > }
> > >
> > > accessible_state_types[ATK_STATE_ACTIVE] = Accessibility_STATE_ACTIVE;
> >
> > ----
> >
>
> > Index: libspi/stateset.c
> > ===================================================================
> > RCS file: /cvs/gnome/at-spi/libspi/stateset.c,v
> > retrieving revision 1.3
> > diff -u -r1.3 stateset.c
> > --- libspi/stateset.c 13 Apr 2002 20:47:46 -0000 1.3
> > +++ libspi/stateset.c 29 Apr 2002 11:44:35 -0000
> > @@ -45,13 +45,14 @@
> > g_return_val_if_fail (accessible_state_types, FALSE);
> > g_return_val_if_fail (atk_state_types, FALSE);
> >
> > - accessible_state_types = g_new (Accessibility_StateType, ATK_STATE_LAST_DEFINED);
> > - atk_state_types = g_new (AtkStateType, ATK_STATE_LAST_DEFINED);
> > -
> > for (i = 0; i < ATK_STATE_LAST_DEFINED; i++)
> > {
> > atk_state_types[i] = ATK_STATE_INVALID;
> > - accessible_state_types[i] = Accessibility_STATE_INVALID;
> > + }
> > +
> > + for (i=0; i < Accessibility_STATE_LAST_DEFINED; i++)
> > + {
> > + accessible_state_types[i] = Accessibility_STATE_INVALID;
> > }
> >
> > accessible_state_types[ATK_STATE_ACTIVE] = Accessibility_STATE_ACTIVE;
> ----
>
> Index: ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/at-spi/ChangeLog,v
> retrieving revision 1.194
> diff -u -p -r1.194 ChangeLog
> --- ChangeLog 22 Apr 2002 18:29:05 -0000 1.194
> +++ ChangeLog 29 Apr 2002 15:46:23 -0000
> @@ -1,3 +1,8 @@
> +2002-04-26 Radek Doulik <rodo ximian com>
> +
> + * libspi/stateset.c (spi_init_state_type_tables): fix size of
> + atk_state_types table
> +
> 2002-04-22 jacob berkman <jacob ximian com>
>
> * util/Makefile.am:
> Index: libspi/stateset.c
> ===================================================================
> RCS file: /cvs/gnome/at-spi/libspi/stateset.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 stateset.c
> --- libspi/stateset.c 13 Apr 2002 20:47:46 -0000 1.3
> +++ libspi/stateset.c 29 Apr 2002 15:46:23 -0000
> @@ -38,20 +38,20 @@ spi_init_state_type_tables (void)
>
> if (accessible_state_types || atk_state_types)
> return FALSE;
> - if (!accessible_state_types)
> - accessible_state_types = g_new (Accessibility_StateType, Accessibility_STATE_LAST_DEFINED);
> - if (!atk_state_types)
> - atk_state_types = g_new (AtkStateType, ATK_STATE_LAST_DEFINED);
> - g_return_val_if_fail (accessible_state_types, FALSE);
> - g_return_val_if_fail (atk_state_types, FALSE);
>
> accessible_state_types = g_new (Accessibility_StateType, ATK_STATE_LAST_DEFINED);
> - atk_state_types = g_new (AtkStateType, ATK_STATE_LAST_DEFINED);
> + g_return_val_if_fail (accessible_state_types, FALSE);
> + atk_state_types = g_new (AtkStateType, Accessibility_STATE_LAST_DEFINED);
> + g_return_val_if_fail (atk_state_types, FALSE);
>
> for (i = 0; i < ATK_STATE_LAST_DEFINED; i++)
> {
> - atk_state_types[i] = ATK_STATE_INVALID;
> accessible_state_types[i] = Accessibility_STATE_INVALID;
> + }
> +
> + for (i = 0; i < Accessibility_STATE_LAST_DEFINED; i++)
> + {
> + atk_state_types[i] = ATK_STATE_INVALID;
> }
>
> accessible_state_types[ATK_STATE_ACTIVE] = Accessibility_STATE_ACTIVE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]