Hi,

  It turns out the problem causing the oid failures is with our 
snprintf. specifically we are formatting "%u" incorrectly:

using a enhanced-for-testing version of our snprintf I get.

formatting '-1040' with '%lu'
  snprintf = 18446744073709550576
  sprintf  = 18446744073709550576

formatting '-1040' with '%u'
  snprintf = 18446744073709550576
  sprintf  = 4294966256


oidout() is where the offending call originates, FWIW.
  snprintf(result, 12, "%u", o);

I've massaged in the snprintf.c code from openssh into postgres, and 
oid now passes the regression test, but have a couple of questions:
  1) could the openssh code be a candidate to replace our version? It 
     looks quite a bit more 'featureful', and I'd imagine it is about 
     as safe as snprintf gets.
  2) do we _need_ oidout() to "%u", or could we "%lu" and fully take
     advantage of the longer long on 64bit platforms?

cheers.
  brent

Reply via email to