Mercurial > gnulib
annotate lib/uniconv/u32-strconv-from-enc.c @ 40212:8da9577294da
unistr/*, uniconv/*: Fix undefined behaviour.
Reported by Jeffrey Walton <noloader@gmail.com>.
* lib/unistr/u-cpy.h (FUNC): Don't invoke memcpy with a zero size.
* lib/unistr/u-cpy-alloc.h (FUNC): Likewise.
* lib/uniconv/u8-conv-from-enc.c (u8_conv_from_encoding): Likewise.
* lib/uniconv/u8-conv-to-enc.c (u8_conv_to_encoding): Likewise.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 09 Mar 2019 00:01:47 +0100 |
parents | b06060465f09 |
children |
rev | line source |
---|---|
7958
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
1 /* Conversion to UTF-32 from legacy encodings. |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
19484
diff
changeset
|
2 Copyright (C) 2002, 2006-2007, 2009-2019 Free Software Foundation, Inc. |
7958
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
3 |
9307
ad8a75a45dc9
Change copyright notice from LGPLv2.0+ to LGPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7958
diff
changeset
|
4 This program is free software: you can redistribute it and/or modify it |
ad8a75a45dc9
Change copyright notice from LGPLv2.0+ to LGPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7958
diff
changeset
|
5 under the terms of the GNU Lesser General Public License as published |
ad8a75a45dc9
Change copyright notice from LGPLv2.0+ to LGPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7958
diff
changeset
|
6 by the Free Software Foundation; either version 3 of the License, or |
ad8a75a45dc9
Change copyright notice from LGPLv2.0+ to LGPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7958
diff
changeset
|
7 (at your option) any later version. |
7958
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
8 |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
9307
ad8a75a45dc9
Change copyright notice from LGPLv2.0+ to LGPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7958
diff
changeset
|
12 Lesser General Public License for more details. |
7958
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
13 |
9307
ad8a75a45dc9
Change copyright notice from LGPLv2.0+ to LGPLv3+.
Bruno Haible <bruno@clisp.org>
parents:
7958
diff
changeset
|
14 You should have received a copy of the GNU Lesser General Public License |
19190 | 15 along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
7958
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
16 |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
17 /* Written by Bruno Haible <bruno@clisp.org>. */ |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
18 |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
19 #include <config.h> |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
20 |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
21 /* Specification. */ |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
22 #include "uniconv.h" |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
23 |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
24 #include <errno.h> |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
25 #include <stdlib.h> |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
26 #include <string.h> |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
27 |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
28 #include "unistr.h" |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
29 |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
30 #define FUNC u32_strconv_from_encoding |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
31 #define UNIT uint32_t |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
32 #define U_CONV_FROM_ENCODING u32_conv_from_encoding |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
33 #define U_STRLEN u32_strlen |
201efa366e62
New module 'uniconv/u32-strconv-from-enc'.
Bruno Haible <bruno@clisp.org>
parents:
diff
changeset
|
34 #include "u-strconv-from-enc.h" |