Re: [msysGit] [PATCH] mingw-multibyte: fix memory acces violation and path length limits.

2013-10-01 Thread Wataru Noguchi

Hi,

Thanks for your advice.

I see. I'll try following tool for optimization affection.

Thanks.

(2013/09/29 20:01), Stefan Beller wrote:

On 09/29/2013 04:56 AM, Wataru Noguchi wrote:


- gcc optimization level is O2.(fail)
- gcc O0, O1 works fine.


Maybe you could try to compile with
STACK found at http://css.csail.mit.edu/stack/
That tool is designed to find
Optimization-unstable code.





--
=
  Wataru Noguchi
  wnoguchi.0...@gmail.com
  http://wnoguchi.github.io/
=
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [msysGit] [PATCH] mingw-multibyte: fix memory acces violation and path length limits.

2013-09-29 Thread Stefan Beller
On 09/29/2013 04:56 AM, Wataru Noguchi wrote:
 
 - gcc optimization level is O2.(fail)
 - gcc O0, O1 works fine.

Maybe you could try to compile with
STACK found at http://css.csail.mit.edu/stack/
That tool is designed to find
Optimization-unstable code.





signature.asc
Description: OpenPGP digital signature


Re: [msysGit] [PATCH] mingw-multibyte: fix memory acces violation and path length limits.

2013-09-28 Thread Johannes Schindelin
Hi,

On Sun, 29 Sep 2013, Wataru Noguchi wrote:

 --- a/convert.c
 +++ b/convert.c
 @@ -724,6 +724,11 @@ static void convert_attrs(struct conv_attrs *ca, const 
 char *path)
  {
   int i;
   static struct git_attr_check ccheck[NUM_CONV_ATTRS];
 + 
 + if (NUM_CONV_ATTRS != 0) {
 + ccheck[0].attr = NULL;
 + ccheck[0].value = NULL;
 + }

I wonder whether it would make more sense to use

memset(ccheck, 0, sizeof(ccheck))

? But then, ccheck is static and *should* be initialized to all 0
according to the C standard. And re-initializing it to NULL would
invalidate the values that were set earlier.

Also, if NUM_CONV_ATTRS == 0, I would expect

   if (!ccheck[0].attr) {

to access an invalid location...

 diff --git a/git-compat-util.h b/git-compat-util.h
 index a31127f..ba02c69 100644
 --- a/git-compat-util.h
 +++ b/git-compat-util.h
 @@ -237,6 +237,16 @@ extern char *gitbasename(char *);
  #ifndef PATH_MAX
  #define PATH_MAX 4096
  #endif
 +#ifdef GIT_WINDOWS_NATIVE
 +/* Git for Windows checkout PATH_MAX is reduce to 260.
 + * but if checkout relative long path name, its length too short.
 + * thus, expand length.
 + */
 +#ifdef PATH_MAX
 +#undef PATH_MAX
 +#endif
 +#define PATH_MAX 4096
 +#endif

This looks fine, but I am wary... did you not say that a crash was caused
by this? In that case, we would have a user that accesses the respective
buffer without checking the size and we would still have to fix that bug..

Ciao,
Dscho
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html