Den ons 24 juli 2024 kl 14:06 skrev Andreas Stieger <andreas.stie...@gmx.de >:
> > On 2024-07-24 13:35, zongganli(李宗淦) wrote: > > We found a bug in svnlook history --limit. > > > Can you describe how this bug manifests itself? > > It can not deal with the illegal input like "-1", as "apr_size_t" could be > unsigned. > > > Not having reviewed this in detail, but maybe we should make this similar > to > > > https://svn.apache.org/viewvc/subversion/trunk/subversion/svn/svn.c?view=markup#l2309 > I've reviewed this and I agree that the behaviour is not correct.. The problem is that the -l option should give an error message if a <= 0 argument is given. Code: https://svn.apache.org/viewvc/subversion/trunk/subversion/svnlook/svnlook.c?view=markup#l2583 But apr_size_t can be unsigned (on my system it is size_t). strtol() will happily parse "-1" but when stored in an apr_size_t it will of course be interpreted as a positive number. Thus the error message isn't shown. Example with Subversion 1.14.3: [[[ dsg@daniel-23:~$ svnlook history -l -1 /home/dsg/repo REVISION PATH -------- ---- 11 / 10 / 9 / [...] 1 / 0 / ]]] Example with trunk + patch: [[[ dsg@daniel-23:~/svn_trunk/subversion/svnlook$ ./svnlook history -l -1 /home/dsg/repo subversion/svnlook/svnlook.c:2595: (apr_err=SVN_ERR_INCORRECT_PARAMS) svnlook: E200004: Argument to --limit must be positive ]]] Thanks for the example in svn.c, I'll test it and see if it suffers the same problem. I agree that the code in svnlook should be the same as everywhere else so I'll probably change it first and then revisit the limit issue. Kind regards, Daniel