1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-22387: Do not violate __attribute__((nonnull))

This follows up commit
commit 94a520ddbe and
commit 7c5519c12d.

After these changes, the default test suites on a
cmake -DWITH_UBSAN=ON build no longer fail due to passing
null pointers as parameters that are declared to never be null,
but plenty of other runtime errors remain.
This commit is contained in:
Marko Mäkelä
2020-11-02 14:19:21 +02:00
parent d2fab68667
commit 8036d0a359
22 changed files with 89 additions and 48 deletions

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2016, MariaDB
Copyright (c) 2016, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -175,8 +175,8 @@ bool String::copy(const String &str)
{
if (alloc(str.str_length))
return TRUE;
str_length=str.str_length;
bmove(Ptr,str.Ptr,str_length); // May be overlapping
if ((str_length=str.str_length))
bmove(Ptr,str.Ptr,str_length); // May be overlapping
Ptr[str_length]=0;
str_charset=str.str_charset;
return FALSE;
@ -539,8 +539,11 @@ bool String::append_ulonglong(ulonglong val)
bool String::append(const char *s,uint32 arg_length, CHARSET_INFO *cs)
{
if (!arg_length)
return false;
uint32 offset;
if (needs_conversion(arg_length, cs, str_charset, &offset))
{
uint32 add_length;