php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72777 Use onig_set_match_stack_limit_size() with mbregex
Submitted: 2016-08-07 23:47 UTC Modified: 2016-09-04 15:12 UTC
From: yohgaki@php.net Assigned: yohgaki (profile)
Status: Assigned Package: mbstring related
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-08-07 23:47 UTC] yohgaki@php.net
Description:
------------
Oniguruma has
onig_set_match_stack_limit_size()
and it should be used for mbregex.

extern int main(int argc, char* argv[])
{
#define MAX_SIZE   1000000

  int len;
  int i;
  char s[MAX_SIZE];

  len = atoi(argv[1]);
  fprintf(stdout, "len: %d\n", len);
  for (i = 0; i < len; i++) {
    s[i] = ' ';
  }
  s[len] = 'a';
  s[len + 1] = '\0';

  onig_set_match_stack_limit_size(30000);

  exec(ONIG_ENCODING_UTF8, ONIG_ENCODING_UTF8, ONIG_OPTION_NONE,
       "\\s+$", s);
  return 0;
}




Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-07 23:48 UTC] yohgaki@php.net
-Assigned To: +Assigned To: yohgaki
 [2016-09-01 10:29 UTC] yohgaki@php.net
Thank you @cmb

Added PR.
Unfortunately, this does not mitigate Bug #60664 :(
 [2016-09-01 11:11 UTC] yohgaki@php.net
Added test for Bug #53099. It seems it works.
 [2016-09-04 15:12 UTC] cmb@php.net
The stack limit would also not solve bug #72970, but nonetheless I
consider introducing a way to explicitly set a stack limit a very
reasonable improvement.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC