[cvsnt] Re: crash in 2.0.58d, ideas about save crashdump feature

Alexey Panchenko alexey-panchenko at hotmail.ru
Thu Dec 9 05:59:44 GMT 2004


Community technical support mailing list was retired 2010 and replaced with a professional technical support team. For assistance please contact: Pre-sales Technical support via email to sales@march-hare.com.


Hello Tony,

Wednesday, December 8, 2004, 6:54:15 PM, you wrote:

TH> I can't see what you're doing there, except moving the pointer to the
TH> end (which isn't going to achieve much, since it's then beyond argc).  I 
TH> must be missing something...

+           char *tmp = argv[i];
            for (j = i; j < argc - 1; ++j)
                argv[j] = argv[j + 1];
+           argv[argc - 1] = tmp;

I copy the skipped argument to the last position in the array.

if array contains

arg1
arg2
arg3

without patch it would become

arg2
arg3
arg3

and

arg3 will be freed twice (running under debugger you can see assert in
heap management code of VC runtime library),

I sugest to make it

arg2
arg3
arg1

So each argument will be freed only once.

This memory is freed in 'do_cvs_command' with the code

free_args_and_return:
    /* Now free the arguments.  */
    {
        /* argument_vector[0] is a dummy argument, we don't mess with it.  */
        char **cp;
        for (cp = argument_vector + 1;
             cp < argument_vector + argument_count;
             ++cp)
            xfree (*cp);

        argument_count = 1;
    }

And the most correct solution is to make a copy of argument_vector,
and free memory using saved pointers.

>> Another way to fix the crash is to make a copy of the
>> 'argument_vector' in function 'static void do_cvs_command (cmd_name,
>> command)' in file 'server.c' and free memory using copied values.

TH> Not keen on copying memory around... too much overhead.

Is just pointers to arguments, once per command execution.
With 1000 arguments it require 1000*sizeof(char*) = 4000 bytes,
and it would not crash even if called functions modify argument_vector
(the add() does it, I am not sure about others).

TH> Try the latest builds - still waiting for some good feedback on that
TH> version.

current CVSNT_2_0_x compiled in debug mode still shows asserts.

Btw, when updating it using stable 58d - it unsuccessfully tries to
rename multiple files from .c to .cpp - is it possible to checkout
renames with 58d ?

When I use 'update -C' it works.

-- 
Best regards,
 Alexey                            mailto:alexey-panchenko at hotmail.ru




More information about the cvsnt mailing list
Download the latest CVSNT, TortosieCVS, WinCVS etc. for Windows 8 etc.
@CVSNT on Twitter   CVSNT on Facebook