Fujii Masao
masao****@gmail*****
2014年 5月 21日 (水) 12:05:07 JST
On Tue, May 20, 2014 at 11:22 PM, Beena Emerson <memis****@gmail*****> wrote: > It was reported that using pg_trgm for turkish locale and UTF8 encoding, > resulted in segmentation fault. The reason was changing the uppercase I to > lowercase required more space. > > This bug was fixed in commit: > > https://github.com/postgres/postgres/commit/c3ccc9ee584b9b015dd9c1931e261e21f3961e5f > > A few checks for the buffer over flow case have also been added in this > commit > > Though pg_bigm does not convert the string to lower case, the checks for > buffer overflow could be added and the attached patch > buffer-overflow-check.patch does that. This patch does not include the > change to add more space to the intermediate buffer. So the check of "(Size) slen >= (MaxAllocSize / pg_database_encoding_max_length()))" is not required? Regarding the check of "(Size) (slen / 2) >= (MaxAllocSize / (sizeof(bigm) * 3))", could you convince me why this check is required? After this check, the memory is allocated as follows. The check is to prevent the part "sizeof(bigm) * (slen / 2 + 1) * 3" from overflowing the maximum size of integer? (BIGM *) palloc(VARHDRSZ + sizeof(bigm) * (slen / 2 + 1) *3); Anyway, I just applied the following part. - if (len > 0) + if (len > 1) > The second patch update-copyright-2014.patch, updates the copyright > information on various files. Thanks, applied! Regards, -- Fujii Masao