This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch] libstdc++/66327 don't pass null pointers to memcmp
- From: JÃrg Richter <joerg dot richter at pdv-fs dot de>
- To: libstdc++ at gcc dot gnu dot org
- Date: Sat, 30 May 2015 09:36:14 +0000 (UTC)
- Subject: Re: [patch] libstdc++/66327 don't pass null pointers to memcmp
- Authentication-results: sourceware.org; auth=none
- References: <20150528223547 dot GT2985 at redhat dot com> <loom dot 20150529T214824-696 at post dot gmane dot org> <20150529232419 dot GD25933 at redhat dot com>
> >How about comparing only the length against 0?
> >The pointers must be != 0 if length > 0.
>
> Like so? Yes, that's probably an improvement, because we need that
> length anyway.
Yes, that is what I had in mind.
I think the second case can be handled equally by
precomputing std::min(__len1, __len2).
- JÃrg