Fix in oracle_compat.c

Started by Nonameover 27 years ago7 messages
#1Noname
jwieck@debis.com

Hi,

the following patch fixes a bug in the oracle compatibility
functions btrim() ltrim() and rtrim().

The error was that the character after the set was included
in the tests (ptr2 pointed to the character after the vardata
part of set if no match found, so comparing *ptr or *end
against *ptr2 MAY match -> strip).

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck@debis.com (Jan Wieck) #

*** oracle_compat.c.orig	Tue Aug 11 16:07:48 1998
--- oracle_compat.c	Tue Aug 11 16:08:37 1998
***************
*** 297,303 ****
  				break;
  			++ptr2;
  		}
! 		if (*ptr != *ptr2)
  			break;
  		ptr++;
  		ptr2 = VARDATA(set);
--- 297,303 ----
  				break;
  			++ptr2;
  		}
! 		if (ptr2 > end2)
  			break;
  		ptr++;
  		ptr2 = VARDATA(set);
***************
*** 316,322 ****
  				break;
  			++ptr2;
  		}
! 		if (*end != *ptr2)
  			break;
  		--end;
  		ptr2 = VARDATA(set);
--- 316,322 ----
  				break;
  			++ptr2;
  		}
! 		if (ptr2 > end2)
  			break;
  		--end;
  		ptr2 = VARDATA(set);
***************
*** 374,380 ****
  				break;
  			++ptr2;
  		}
! 		if (*ptr != *ptr2)
  			break;
  		ptr++;
  		ptr2 = VARDATA(set);
--- 374,380 ----
  				break;
  			++ptr2;
  		}
! 		if (ptr2 > end2)
  			break;
  		ptr++;
  		ptr2 = VARDATA(set);
***************
*** 434,440 ****
  				break;
  			++ptr2;
  		}
! 		if (*ptr != *ptr2)
  			break;
  		--ptr;
  		ptr2 = VARDATA(set);
--- 434,440 ----
  				break;
  			++ptr2;
  		}
! 		if (ptr2 > end2)
  			break;
  		--ptr;
  		ptr2 = VARDATA(set);
#2Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Noname (#1)
Re: [HACKERS] Fix in oracle_compat.c

Hi,

the following patch fixes a bug in the oracle compatibility
functions btrim() ltrim() and rtrim().

The error was that the character after the set was included
in the tests (ptr2 pointed to the character after the vardata
part of set if no match found, so comparing *ptr or *end
against *ptr2 MAY match -> strip).

Jan, now that you have surfaced, can you let us know if the rewrite
system rewrite will be done for 6.4?

-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)
#3Noname
jwieck@debis.com
In reply to: Bruce Momjian (#2)
Re: [HACKERS] Fix in oracle_compat.c

Hi,

the following patch fixes a bug in the oracle compatibility
functions btrim() ltrim() and rtrim().

The error was that the character after the set was included
in the tests (ptr2 pointed to the character after the vardata
part of set if no match found, so comparing *ptr or *end
against *ptr2 MAY match -> strip).

Jan, now that you have surfaced, can you let us know if the rewrite
system rewrite will be done for 6.4?

What's the deadline for 6.4?

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck@debis.com (Jan Wieck) #

#4Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Noname (#3)
Re: [HACKERS] Fix in oracle_compat.c

Hi,

the following patch fixes a bug in the oracle compatibility
functions btrim() ltrim() and rtrim().

The error was that the character after the set was included
in the tests (ptr2 pointed to the character after the vardata
part of set if no match found, so comparing *ptr or *end
against *ptr2 MAY match -> strip).

Jan, now that you have surfaced, can you let us know if the rewrite
system rewrite will be done for 6.4?

What's the deadline for 6.4?

End of this month. No one has asked for an extension yet.

-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)
#5Noname
jwieck@debis.com
In reply to: Bruce Momjian (#4)
Re: [HACKERS] Fix in oracle_compat.c

Hi,

the following patch fixes a bug in the oracle compatibility
functions btrim() ltrim() and rtrim().

The error was that the character after the set was included
in the tests (ptr2 pointed to the character after the vardata
part of set if no match found, so comparing *ptr or *end
against *ptr2 MAY match -> strip).

Jan, now that you have surfaced, can you let us know if the rewrite
system rewrite will be done for 6.4?

What's the deadline for 6.4?

End of this month. No one has asked for an extension yet.

Hmmm - got a new PC at home (333MHz PII, 64MB) - that guarantees
short turn arounds in development.

But home is now my own house - that works against time at all :-)

Since you asked me that often now, I think it's really time
to take a look at it.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck@debis.com (Jan Wieck) #

#6Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Noname (#5)
Re: [HACKERS] Fix in oracle_compat.c

End of this month. No one has asked for an extension yet.

Hmmm - got a new PC at home (333MHz PII, 64MB) - that guarantees
short turn arounds in development.

But home is now my own house - that works against time at all :-)

Since you asked me that often now, I think it's really time
to take a look at it.

Great. We just have so many TODO/bug items that are wrapped up in that
rewrite system, I would really like to get that stuff fixed.

Even if you break it in the process, we need to overhaul the code, and
no one really understands it like you.

-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)
#7Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Noname (#1)
Re: [HACKERS] Fix in oracle_compat.c

Patch applied.

Hi,

the following patch fixes a bug in the oracle compatibility
functions btrim() ltrim() and rtrim().

The error was that the character after the set was included
in the tests (ptr2 pointed to the character after the vardata
part of set if no match found, so comparing *ptr or *end
against *ptr2 MAY match -> strip).

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck@debis.com (Jan Wieck) #

*** oracle_compat.c.orig	Tue Aug 11 16:07:48 1998
--- oracle_compat.c	Tue Aug 11 16:08:37 1998
***************
*** 297,303 ****
break;
++ptr2;
}
! 		if (*ptr != *ptr2)
break;
ptr++;
ptr2 = VARDATA(set);
--- 297,303 ----
break;
++ptr2;
}
! 		if (ptr2 > end2)
break;
ptr++;
ptr2 = VARDATA(set);
***************
*** 316,322 ****
break;
++ptr2;
}
! 		if (*end != *ptr2)
break;
--end;
ptr2 = VARDATA(set);
--- 316,322 ----
break;
++ptr2;
}
! 		if (ptr2 > end2)
break;
--end;
ptr2 = VARDATA(set);
***************
*** 374,380 ****
break;
++ptr2;
}
! 		if (*ptr != *ptr2)
break;
ptr++;
ptr2 = VARDATA(set);
--- 374,380 ----
break;
++ptr2;
}
! 		if (ptr2 > end2)
break;
ptr++;
ptr2 = VARDATA(set);
***************
*** 434,440 ****
break;
++ptr2;
}
! 		if (*ptr != *ptr2)
break;
--ptr;
ptr2 = VARDATA(set);
--- 434,440 ----
break;
++ptr2;
}
! 		if (ptr2 > end2)
break;
--ptr;
ptr2 = VARDATA(set);
-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)