Discussions  >  Issues  >  [Issue 1] New - SvnClient.SetProperty with empty bytes fails

Back to topic list

[Issue 1] New - SvnClient.SetProperty with empty bytes fails

Author svolo4 (OCN Member)
Full name Alexej Kochetkov
Date 2009-10-06 09:04:24 PDT
Message http://sharpsvn.open​.collab.net/issues/s​how_bug.cgi?id=1
                 Issue #|1
                 Summary|SvnClient.SetProperty with empty bytes fails
               Component|sharpsvn
                 Version|current
                Platform|PC
              OS/Version|All
                     URL|
                  Status|NEW
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P3
            Subcomponent|www
             Assigned to|issues@sharpsvn
             Reported by|svolo4






------- Additional comments from XXXX@XXXX Tue Oct 6 09:04:24 -0700 2009 -------
SharpSvn.SvnClient.S​etProperty(string target, string propertyName,
ICollection<byte> bytes) with empty bytes (bytes.Count == 0) fail with
System.IndexOutOfRangeException in
SharpSvn.Implementat​ion.AprPool.AllocSvn​String(byte[] bytes) in
sharpsvn\src\Sharp​Svn\AprPool.cpp line 351:
pin_ptr<Byte> pBytes = &bytes[0];

Reason: you can not access bytes element 0 because it does not exist
(bytes.Length == 0).

Workaround: use SharpSvn.SvnClient.S​etProperty(string target, string
propertyName, string value) overload with string.Empty if bytes.Count == 0.

Possible fix: surround line 351 and 352 with "if" like:
    if (bytes->Length != 0)
    {
        pin_ptr<Byte> pBytes = &bytes[0];
        memcpy(pChars, pBytes, bytes->Length);
    }

Consider also: other parts in the code where copying from empty byte[] is
possible.

« Previous message in topic | 1 of 2 | Next message in topic »

Messages

Show all messages in topic

[Issue 1] New - SvnClient.SetProperty with empty bytes fails svolo4 (OCN Member) Alexej Kochetkov 2009-10-06 09:04:24 PDT
     [Issue 1] SvnClient.SetProperty with empty bytes fails rhuijben (OCN Member) Bert Huijben 2011-12-29 10:00:38 PST
Messages per page: