Guest User

pcre memory bug

a guest
Aug 7th, 2011
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. mainPageCredRx=pcre_compile("class=\"credits_value\"[^<>]*>(\\d+)</sp",PCRE_CASELESS,&pcreErr,&pcreErrOffset,NULL);//so i need array of 4 integers : 2 for pattern and 2 for subpattern
  2. mainPageCredRxExtr=pcre_study(mainPageCredRx,0,&pcreErr);
  3. .....
  4. {
  5. int poss[5];//with a small margin
  6. char *cstr=(char*)buf.c_str();
  7. int flds=pcre_exec(mainPageCredRx,mainPageCredRxExtr,cstr,buf.length(),0,0,poss,5);
  8. /*we got:
  9. flds=0
  10. poss :
  11.         [0] 5212    int
  12.         [1] 5238    int
  13.         [2] -1  int
  14.         [3] -1  int
  15.         [4] -858993460  int
  16.  
  17. */
  18. }
  19. {
  20. int poss[10];//with a small margin
  21. int flds=pcre_exec(mainPageCredRx,mainPageCredRxExtr,cstr,buf.length(),0,0,poss,10);
  22. /*we got:
  23. flds=2
  24. poss :
  25.         [0] 5212    int
  26.         [1] 5238    int
  27.         [2] 5230    int
  28.         [3] 5234    int
  29.         [4] -858993460  int
  30.         [5] -858993460  int
  31.         [6] -858993460  int
  32.         [7] -858993460  int
  33.         [8] 5230    int
  34.         [9] -858993460  int
  35.  
  36.  
  37. */}
Advertisement
Add Comment
Please, Sign In to add comment