Use heap to allocate PatternMatch to avoid potential stack overflow
authorMichael Vogt <mvo@ubuntu.com>
Tue, 2 Sep 2014 15:06:52 +0000 (17:06 +0200)
committerMichael Vogt <mvo@ubuntu.com>
Tue, 2 Sep 2014 15:25:35 +0000 (17:25 +0200)
commit097248092ea4ff4543dfb17deb4e0d31dd697c71
treee6af763c1fe68a76960c92473a120edc13b101b4
parentcbcdd3ee9d86379d1b3a44e41ae8b17dc23111d0
Use heap to allocate PatternMatch to avoid potential stack overflow

When apt-cache search with many args (> 130) is given the allocation
of PatternMatch on the stack may fail resulting in a segmentation
fault. By using the heap the max size is much bigger and we also
get a bad_alloc expection instead of a segfault (which we can catch
*if* this ever becomes a pratical problem). No test for the crash
as its not reproducable with the MALLOC_ settings in framework.

Closes: 759612
cmdline/apt-cache.cc