Re: Minor binary-search int overflow in timezone code

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christoph Berg <cb(at)df7cb(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Minor binary-search int overflow in timezone code
Date: 2014-12-15 14:51:40
Message-ID: 21813.1418655100@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Christoph Berg <cb(at)df7cb(dot)de> writes:
> a fellow Debian Developer found a minor glitch in
> src/timezone/localtime.c, where binary search is used. Now I don't
> think there is an actual problem (unless there's > 2^30 timezones),
> but it would at least make sense to mark the code as okayish so that
> people running code scanners won't stumble over the issue again.

> The attached patch added comments to address this.

This is totally silly. The timecnt couldn't be anywhere near INT_MAX (in
fact, it is not allowed to exceed TZ_MAX_TIMES, which is currently just
1200). And there are bunches of other instances of similar code in PG;
shall we put equally wishy-washy comments on them all?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-12-15 15:01:05 Re: speedup tidbitmap patch: hash BlockNumber
Previous Message Heikki Linnakangas 2014-12-15 14:29:41 Re: Custom timestamp format in logs