马亮 | 3 Apr 2013 10:31
Favicon
Gravatar

little bug on hdf_remove_tree()

 

hi,
    It seems that hdf->last_hs, hdf->last_hp should set to NULL, if hdf_remove_tree() dealloced them.
    following code can run normally, but valgrind detected one "Invalid read of size", so, please take a look:
    (also viewable on https://gist.github.com/bigml/5299443)

int main(int argc, char **argv, char **envp)
{
    HDF *node, *cnode;
    hdf_init(&node);

    hdf_set_value(node, "foo.0.pic", "xxx.jpg");
    hdf_set_value(node, "bar.0.pic", "yyy.jpg");

    cnode = hdf_get_child(node, "foo");
    hdf_copy(node, "gifts.0", cnode);

    cnode = hdf_get_child(node, "bar");
    hdf_copy(node, "gifts.1", cnode);

    hdf_remove_tree(node, "bar");

    hdf_set_value(node, "zzzz", "4");

    hdf_destroy(&node);

    return 0;
}


this is the valgrind output: div>

[root <at> mdev demo]# valgrind --leak-check=full ./hdfremove
==16521== Memcheck, a memory error detector.
==16521== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al.
==16521== Using LibVEX rev 1658, a library for dynamic binary translation.
==16521== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
==16521== Using valgrind-3.2.1, a dynamic binary instrumentation framework.
==16521== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al.
==16521== For more details, rerun with: -v
==16521== 
==16521== Invalid read of size 8
==16521==    at 0x41D653: _set_value (neo_hdf.c:675)
==16521==    by 0x41E397: hdf_set_value (neo_hdf.c:829)
==16521==    by 0x406382: main (hdfremove.c:22)
==16521==  Address 0x6FE5558 is 48 bytes inside a block of size 112 free'd
==16521==    at 0x4A0541E: free (vg_replace_malloc.c:233)
==16521==    by 0x41CF43: _dealloc_hdf (neo_hdf.c:164)
==16521==    by 0x41D0AA: hdf_remove_tree (neo_hdf.c:1018)iv>
==16521==    by 0x40636F: main (hdfremove.c:20)
==16521== 
==16521== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 1)
==16521== malloc/free: in use at exit: 184 bytes in 2 blocks.
==16521== malloc/free: 33 allocs, 31 frees, 1,797 bytes allocated.
==16521== For counts of detected errors, rerun with: -v
==16521== searching for pointers to 2 not-freed blocks.
==16521== checked 792,216 bytes.
==16521== 
==16521== LEAK SUMMARY:
==16521==    definitely lost: 0 bytes in 0 blocks.
==16521==      possibly lost: 0 bytes in 0 blocks.
==16521==    still reachable: 184 bytes in 2 blocks.
==16521==         suppressed: 0 bytes in 0 blocks.
==16521== Reachable blocks (those to which a pointer was found) are not shown.
==16521== To see them, rerun with: --show-reachable=yes
[root <at> mdev demo]# 



__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
Recent Activity:
    .

    __,_._,___
    paragshravagi | 5 Feb 2013 12:55
    Picon
    Favicon

    Re: VC++

     

    I tried to download this patch from the mentioned link. But the site cannot be reached.
    Can someone share the patch again?

    Best Regards,
    ParagS

    --- In ClearSilver <at> yahoogroups.com, "Szolnoki Tibor" wrote:
    >
    > I can successfully compiled ClearSilver with MS Visual Studio 2005/2008.
    >
    > Tested with ClearSilver++ and FastCGI.
    >
    > My patch downloadable from:
    > http://www.szolnoki.net/cs/clearsilver-0.10.5-vs.patch.zip
    >
    >
    > T. Szolnoki
    >

    __._,_.___
    Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)
    Recent Activity:
    .

    __,_._,___
    马亮 | 10 Nov 2012 14:55
    Favicon
    Gravatar

    high-speed hdf-json-bson converter

     

    hi, cs

    I have an application need high-spped json, hdf, bson converter. I can't find it on internet, so, I coded them, put them on https://github.com/bigml/cmoon/blob/master/lib/mnl/mbson.h  mbson.c mjson.h mjson.c

    It's performance can't satisfy my need. A 5-node object convert need almost 10 usecond. I want it done in 1 usecond (1,000,000 conversion per second).

    So, Is there anybody intrest on this? Let's improve it together.


    the test program gist on    https://gist.github.com/4051150


    __._,_.___
    Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)
    Recent Activity:
      .

      __,_._,___
      Rod | 14 Aug 2012 19:44
      Picon
      Favicon

      At what point does CS acquire its data from the HDF backend database?

       

      I have an application that I'm developing, and hoping to use CS for part of it. It also uses the GNU libmicrohttpd for providing built-in HTTP server support.
      Its basic functionality is that the tool runs for extended periods, all the while acquiring data in quasi-realtime from a proprietary fieldbus in a control system. The HTTP interface is to provide runtime updates to the end user, and to alter configuration of the tool.

      In the (C-language) code, I first instantiate the HDF with hdf_init(), then instantiate a parser with cs_init(), associating the parser with the HDF. I then read the template file by calling cs_parse_file().
      Finally, I launch the HTTP daemon thread, and spin around grabbing data from the wire, populating and updating the HDF database.
      In a callback function launched by the HTTP library, I call cs_render(), which generates a page according to the template, except that the template macros are never replaced by the HDF data. I know that the HDF data is being correctly recorded, since when I call hdf_write_file(), the expected data is written to the file.

      My theory is that the binding between the HDF data and the parser is done at the time cs_parse_file() is called. If so, is there any way for the binding to be 'renewed' to reflect the latest data?
      Or, am I doing something fundamentally wrong? I do not want to re-read and parse the template file each time an HTTP request is to be serviced.

      In a simple testbed, I am able to read the HDF data file using hdf_read_file(), parse the template and render the data as expected, so I feel confident that my code is generating and using the correct CS template syntax.

      I seem to remember finding a small number of sample code fragments and/or applications online a while ago, but can't seem to locate them any more. Does anyone have links to those that still work?

      Thanks.

      --- rod.

      __._,_.___
      Recent Activity:
        .

        __,_._,___
        Rod | 13 Jul 2012 22:25
        Picon
        Favicon

        ClearSilver shared object libraries?

         

        Just started using ClearSilver, and wondering why there aren't any shared object libraries being built. Is there some technical reason that I don't grok, or have I erred somewhere?

        --- rod.

        __._,_.___
        Recent Activity:
        .

        __,_._,___
        camio | 27 Jun 2012 02:39
        Picon
        Favicon

        Crashes with the python plugin

         

        Hello,

        I've been trying to make a new egg of the python module for version 0.10.5. Unfortunately, I'm getting crash behavior particularly in the cs_destroy function in my tests. The second uListDestroy and dealloc_function calls both cause a crash in cs_destroy. When I comment those out, I don't get a problem.

        Any ideas?

        David

        __._,_.___
        Recent Activity:
        .

        __,_._,___
        bxxx | 23 Apr 2012 09:51
        Picon
        Favicon

        Filter at runtime

         

        Hello Brandon, hello everybody,

        I want to filter every dataset into clearsilver hdf at runtime.
        OR is it possible to (override | add hook) "var" hdf function ?

        thanks
        VB

        __._,_.___
        Recent Activity:
          .

          __,_._,___
          David Jeske | 7 Apr 2012 23:57
          Picon
          Gravatar

          clearsilver bug in cgi-parse, form posting with explicit chartset...

           

          I just ran into a bug in clearsilver that I'm surprised has existed for so long.

          The problem occured because Firefox is specifying a character set in the content type of form posts, ala...

             application/x-www-form-urlencoded; charset=UTF-8

          Clearsilver cgi_parse was expecting an exact match for "application/x-www-form-urlencoded"..

          I fixed this by having clearsilver check only the prefix of content type, as you can see in my patch below. There is probably a better way to fix this, by having clearsilver properly parse the content type for it's parts according to the spec. Though perhaps this fix is enough...




          root <at> w5:/home/hassan# diff -c clearsilver-0.10.5-orig/cgi/cgi.c clearsilver-0.10.5/cgi/cgi.c
          *** clearsilver-0.10.5-orig/cgi/cgi.c   2007-07-11 19:38:03.000000000 -0700
          --- clearsilver-0.10.5/cgi/cgi.c        2012-04-07 14:52:12.742725038 -0700
          ***************
          *** 640,646 ****

              if (!strcmp(method, "POST"))
              {
          !     if (type && !strcmp(type, "application/x-www-form-urlencoded"))
                {
                  err = _parse_post_form(cgi);
                  if (err != STATUS_OK) return nerr_pass (err);
          --- 640,647 ----

              if (!strcmp(method, "POST"))
              {
          !     const char *formType = "application/x-www-form-urlencoded";
          !     if (type && !strncmp(type, formType, strlen(formType)-1 ))
                {
                  err = _parse_post_form(cgi);
                  if (err != STATUS_OK) return nerr_pass (err);

          __._,_.___
          Recent Activity:
            .

            __,_._,___
            bxxx | 20 Mar 2012 17:52
            Picon
            Favicon

            Best solution for output file directly

             

            What is the best solution with clearsilver (C API of course) to send a file directly to the browser?

            thx

            __._,_.___
            Recent Activity:
            .

            __,_._,___
            Michael Moody | 20 Feb 2012 11:18
            Picon
            Favicon

            Support Ticket System - Knowledge base software

             

            Dynamically route and assign help desk tickets to any specific technician or group of technicians using your organization's business logic; based on ticket categories, technician skill set, location, department, technician availability and work load balance.

            knowledge base software  | knowledgebase software

            __._,_.___
            Recent Activity:
            .

            __,_._,___
            Matthew | 15 Mar 2012 06:55
            Picon
            Favicon

            is there any syntax template for cs file?

             

            http://www.vim.org/scripts/script.php?script_id=1100
            I fount this, but I think it doesn't work, so who can tell me is there a file for this?

            __._,_.___
            Recent Activity:
            .

            __,_._,___

            Gmane