Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Runtime Error on PCRE library, really need help!

Runtime Error on PCRE library, really need help!

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpcsharpvisual-studiolinux
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tomfd3s
    wrote on last edited by
    #1

    I'm trying to port the FreeLing (Natural Language Processor) from linux to windows platform. The FreeLing used the PCRE library for reg-ex. The FreeLing is built on C++ (normal STL) langauage. And I know that it's required a C++ Wrapper for PCRE. BTW, FreeLing have included C++ Wrapper in their project. I'm trying to use its built-in wrapper because it is modify to suitable for their code. If I change to another wrapper for PCRE, I think I could have a lot of work to modify the wrapper. Let's see the error here. The Runtime error occur when the "void clone();" in "regexp.h" in FreeLing is running. Here's the part of "regexp.h" in FreeLing. The error is on "pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size);" Line. private: void clone(const RegEx &y) { size_t size; if (!y.re) return; pcre_fullinfo(y.re, 0, PCRE_INFO_SIZE, &size); re=(pcre*) new char[size]; if (!re) { throw "not enough memory"; } else { std::cout << std::endl << "**** Making new re pointer Allocation successful.. *****" << std::endl; } memcpy(re, y.re, size); // Run time error on pcre_fullinfo(); pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size); pe = (pcre_extra *) new char[size]; if (!pe) throw "not enough memory"; memcpy(pe, y.pe, size); substrcount = y.substrcount; ovector = new int[3*substrcount]; matchlist = NULL; } And the error in pcre_fullinfo(); in PCRE.C is below. On the line "*((size_t *)where) = (study == NULL)? 0 : study->size;" below "CASE:PCRE_INFO_STUDYSIZE"; int pcre_fullinfo(const pcre *external_re, const pcre_extra *extra_data, int what, void *where) { const real_pcre *re = (const real_pcre *)external_re; const pcre_study_data *study = NULL; if (re == NULL || where == NULL) return PCRE_ERROR_NULL; if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC; if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_STUDY_DATA) != 0) study = extra_data->study_data; switch (what) { case PCRE_INFO_OPTIONS: *((unsigned long int *)where) = re->options & PUBLIC_OPTIONS; break; case PCRE_INFO_SIZE: *((size_t *)where) = re->size; break; case PCRE_INFO_STUDYSIZE: *((size_t *)where) = (study == NULL)? 0 : study->size; break; // more code here I'm using VS.NET 2003 and the error-pop

    T J 2 Replies Last reply
    0
    • T tomfd3s

      I'm trying to port the FreeLing (Natural Language Processor) from linux to windows platform. The FreeLing used the PCRE library for reg-ex. The FreeLing is built on C++ (normal STL) langauage. And I know that it's required a C++ Wrapper for PCRE. BTW, FreeLing have included C++ Wrapper in their project. I'm trying to use its built-in wrapper because it is modify to suitable for their code. If I change to another wrapper for PCRE, I think I could have a lot of work to modify the wrapper. Let's see the error here. The Runtime error occur when the "void clone();" in "regexp.h" in FreeLing is running. Here's the part of "regexp.h" in FreeLing. The error is on "pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size);" Line. private: void clone(const RegEx &y) { size_t size; if (!y.re) return; pcre_fullinfo(y.re, 0, PCRE_INFO_SIZE, &size); re=(pcre*) new char[size]; if (!re) { throw "not enough memory"; } else { std::cout << std::endl << "**** Making new re pointer Allocation successful.. *****" << std::endl; } memcpy(re, y.re, size); // Run time error on pcre_fullinfo(); pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size); pe = (pcre_extra *) new char[size]; if (!pe) throw "not enough memory"; memcpy(pe, y.pe, size); substrcount = y.substrcount; ovector = new int[3*substrcount]; matchlist = NULL; } And the error in pcre_fullinfo(); in PCRE.C is below. On the line "*((size_t *)where) = (study == NULL)? 0 : study->size;" below "CASE:PCRE_INFO_STUDYSIZE"; int pcre_fullinfo(const pcre *external_re, const pcre_extra *extra_data, int what, void *where) { const real_pcre *re = (const real_pcre *)external_re; const pcre_study_data *study = NULL; if (re == NULL || where == NULL) return PCRE_ERROR_NULL; if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC; if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_STUDY_DATA) != 0) study = extra_data->study_data; switch (what) { case PCRE_INFO_OPTIONS: *((unsigned long int *)where) = re->options & PUBLIC_OPTIONS; break; case PCRE_INFO_SIZE: *((size_t *)where) = re->size; break; case PCRE_INFO_STUDYSIZE: *((size_t *)where) = (study == NULL)? 0 : study->size; break; // more code here I'm using VS.NET 2003 and the error-pop

      T Offline
      T Offline
      tomfd3s
      wrote on last edited by
      #2

      More information on the Call Stack under debug It seem that error is from the "study" variable, which is of "pcre_study_data" type. - re 0x00324278 {magic_number=0x50435245 size=0x0000005e tables=0x00737140 "" ...} const real_pcre * magic_number 0x50435245 unsigned long size 0x0000005e unsigned int + tables 0x00737140 "" const unsigned char * options 0x00000010 unsigned long top_bracket 0x0001 unsigned short top_backref 0x0000 unsigned short first_byte 0xcdcd unsigned short req_byte 0xcdcd unsigned short name_entry_size 0x0003 unsigned short name_count 0x0000 unsigned short - study 0xabababab {size=??? options=??? start_bits=0xabababb0 } const pcre_study_data * size CXX0030: Error: expression cannot be evaluated unsigned int options CXX0030: Error: expression cannot be evaluated unsigned char + start_bits 0xabababb0 unsigned char [32]

      1 Reply Last reply
      0
      • T tomfd3s

        I'm trying to port the FreeLing (Natural Language Processor) from linux to windows platform. The FreeLing used the PCRE library for reg-ex. The FreeLing is built on C++ (normal STL) langauage. And I know that it's required a C++ Wrapper for PCRE. BTW, FreeLing have included C++ Wrapper in their project. I'm trying to use its built-in wrapper because it is modify to suitable for their code. If I change to another wrapper for PCRE, I think I could have a lot of work to modify the wrapper. Let's see the error here. The Runtime error occur when the "void clone();" in "regexp.h" in FreeLing is running. Here's the part of "regexp.h" in FreeLing. The error is on "pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size);" Line. private: void clone(const RegEx &y) { size_t size; if (!y.re) return; pcre_fullinfo(y.re, 0, PCRE_INFO_SIZE, &size); re=(pcre*) new char[size]; if (!re) { throw "not enough memory"; } else { std::cout << std::endl << "**** Making new re pointer Allocation successful.. *****" << std::endl; } memcpy(re, y.re, size); // Run time error on pcre_fullinfo(); pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size); pe = (pcre_extra *) new char[size]; if (!pe) throw "not enough memory"; memcpy(pe, y.pe, size); substrcount = y.substrcount; ovector = new int[3*substrcount]; matchlist = NULL; } And the error in pcre_fullinfo(); in PCRE.C is below. On the line "*((size_t *)where) = (study == NULL)? 0 : study->size;" below "CASE:PCRE_INFO_STUDYSIZE"; int pcre_fullinfo(const pcre *external_re, const pcre_extra *extra_data, int what, void *where) { const real_pcre *re = (const real_pcre *)external_re; const pcre_study_data *study = NULL; if (re == NULL || where == NULL) return PCRE_ERROR_NULL; if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC; if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_STUDY_DATA) != 0) study = extra_data->study_data; switch (what) { case PCRE_INFO_OPTIONS: *((unsigned long int *)where) = re->options & PUBLIC_OPTIONS; break; case PCRE_INFO_SIZE: *((size_t *)where) = re->size; break; case PCRE_INFO_STUDYSIZE: *((size_t *)where) = (study == NULL)? 0 : study->size; break; // more code here I'm using VS.NET 2003 and the error-pop

        J Offline
        J Offline
        jmkhael
        wrote on last edited by
        #3

        The address 0xabababab indicates a memory following a block allocated by LocalAlloc(). Means that you are stepping (wayyy) outside of your memory block Try setting a conditional break point on when the variable study change Papa while (TRUE) Papa.WillLove ( Bebe ) ;

        T 1 Reply Last reply
        0
        • J jmkhael

          The address 0xabababab indicates a memory following a block allocated by LocalAlloc(). Means that you are stepping (wayyy) outside of your memory block Try setting a conditional break point on when the variable study change Papa while (TRUE) Papa.WillLove ( Bebe ) ;

          T Offline
          T Offline
          tomfd3s
          wrote on last edited by
          #4

          I'm trying to watch the variable and set the breakpoint, but I have no idea where to figure out!!. The only thing I would suggest is the variable "study". Any clue/hint?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups