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. Buffer overrun at _CRT_DEBUGGER_HOOK in dbghook.c (using log4cxx)

Buffer overrun at _CRT_DEBUGGER_HOOK in dbghook.c (using log4cxx)

Scheduled Pinned Locked Moved C / C++ / MFC
4 Posts 3 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.
  • D Offline
    D Offline
    Dropkicked Murphy
    wrote on last edited by
    #1

    That sums it up pretty much - The line method executed before is

    void Writer::DoWrite(QString auditEntry){
    QByteArray ba = auditEntry.toLatin1();
    char* aestr = ba.data();
    std::string aestdstr(aestr);

    log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger("RMAT");
    LOG4CXX\_INFO(logger, aestdstr);//Buffer overrun happens somewhere in this method call
    

    }

    I did the search work - Yes, aestdstr is terminated with '\0'. I'm running out of ideas here. The detailed error message is called

    Quote:

    A buffer overrun has occurred in app.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program. For more details please see Help topic 'How to debug Buffer Overrun Issues'.

    Fun fact is that no one has ever seen the help topic 'How to debug Buffer Overrun Issues' (here[^]). Any thoughts on the issue?

    L S 2 Replies Last reply
    0
    • D Dropkicked Murphy

      That sums it up pretty much - The line method executed before is

      void Writer::DoWrite(QString auditEntry){
      QByteArray ba = auditEntry.toLatin1();
      char* aestr = ba.data();
      std::string aestdstr(aestr);

      log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger("RMAT");
      LOG4CXX\_INFO(logger, aestdstr);//Buffer overrun happens somewhere in this method call
      

      }

      I did the search work - Yes, aestdstr is terminated with '\0'. I'm running out of ideas here. The detailed error message is called

      Quote:

      A buffer overrun has occurred in app.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program. For more details please see Help topic 'How to debug Buffer Overrun Issues'.

      Fun fact is that no one has ever seen the help topic 'How to debug Buffer Overrun Issues' (here[^]). Any thoughts on the issue?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Looking at the documentation for LOG4CXX_INFO[^], I wonder if you should use the char* as the second parameter, like:

      char\* aestr = ba.data();
      

      // std::string aestdstr(aestr);

      log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger("RMAT");
      LOG4CXX\_INFO(logger, aestr);
      

      }

      D 1 Reply Last reply
      0
      • L Lost User

        Looking at the documentation for LOG4CXX_INFO[^], I wonder if you should use the char* as the second parameter, like:

        char\* aestr = ba.data();
        

        // std::string aestdstr(aestr);

        log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger("RMAT");
        LOG4CXX\_INFO(logger, aestr);
        

        }

        D Offline
        D Offline
        Dropkicked Murphy
        wrote on last edited by
        #3

        Thank you kindly for the suggestion, but oddly a missing [static] library on which log4cxx was dependent went missing. Don't ask me why the Linker didn't complain but the debugger decided to throw a buffer overrun :~

        A ghost from the past. Known to others as "Linda".

        1 Reply Last reply
        0
        • D Dropkicked Murphy

          That sums it up pretty much - The line method executed before is

          void Writer::DoWrite(QString auditEntry){
          QByteArray ba = auditEntry.toLatin1();
          char* aestr = ba.data();
          std::string aestdstr(aestr);

          log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger("RMAT");
          LOG4CXX\_INFO(logger, aestdstr);//Buffer overrun happens somewhere in this method call
          

          }

          I did the search work - Yes, aestdstr is terminated with '\0'. I'm running out of ideas here. The detailed error message is called

          Quote:

          A buffer overrun has occurred in app.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program. For more details please see Help topic 'How to debug Buffer Overrun Issues'.

          Fun fact is that no one has ever seen the help topic 'How to debug Buffer Overrun Issues' (here[^]). Any thoughts on the issue?

          S Offline
          S Offline
          Stephen Hewitt
          wrote on last edited by
          #4

          This is probably where the buffer overrun was detected, not where it actually occurred. In general it is not possible (or prohibitively expensive) to detect the actual corruption. Try using the Page Heap[^], although this often falls in the prohibitively expensive category. Remember to disable it when you're done! WARNING: DO NOT ENABLE THE PAGE HEAP FOR ALL PROCESSES, JUST THE ONE YOU'RE DEBUGGING. YOU HAVE BEEN WARNED!

          Steve

          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