forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit54386f3
committed
Remove triggerable Assert in hashname().
hashname() asserted that the key string it is given is shorter thanNAMEDATALEN. That should surely always be true if the input is in fact aregular value of type "name". However, for reasons of coding convenience,we allow plain old C strings to be treated as "name" values in many places.Some SQL functions accept arbitrary "text" inputs, convert them to Cstrings, and pass them otherwise-untransformed to syscache lookups for namecolumns, allowing an overlength input value to trigger hashname's Assert.This would be a DOS problem, except that it only happens in assert-enabledbuilds which aren't recommended for production. In a production build,you'll just get a name lookup error, since regardless of the hash valuecomputed by hashname, the later equality comparison checks can't match.Likewise, if the catalog lookup is done by seqscan or indexscan searches,there will just be a lookup error, since the name comparison functionsdon't contain any similar length checks, and will see an overlength inputas unequal to any stored entry.After discussion we concluded that we should simply remove this Assert.It's inessential to hashname's own functionality, and having such anassertion in only some paths for name lookup is more of a foot-gun thana useful check. There may or may not be a case for the affected callersto do something other than let the name lookup fail, but we'll considerthat separately; in any case we probably don't want to change suchbehavior in the back branches.Per report from Tushar Ahuja. Back-patch to all supported branches.Report:https://postgr.es/m/7d0809ee-6f25-c9d6-8e74-5b2967830d49@enterprisedb.comDiscussion:https://postgr.es/m/17691.1482523168@sss.pgh.pa.us1 parenta3aef88 commit54386f3
1 file changed
+1
-4
lines changedLines changed: 1 addition & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
134 | 134 |
| |
135 | 135 |
| |
136 | 136 |
| |
137 |
| - | |
138 | 137 |
| |
139 |
| - | |
140 |
| - | |
141 |
| - | |
| 138 | + | |
142 | 139 |
| |
143 | 140 |
| |
144 | 141 |
| |
|
0 commit comments
Comments
(0)