Commit graph

33 commits

Author SHA1 Message Date
The Android Open Source Project
7fd5f8d2bc DO NOT MERGE - Merge RP1A.201005.006
Bug: 168212094
Change-Id: I79a7517bce1c012eac2a2a7c1c2cffc5a3516eaa
Merged-In: Ia85067d4258bde4b875c832d6223db5dd26b8838
2020-10-06 04:30:21 +00:00
Steven Moreland
bad50ed24f libutils: check vsnprintf error
For encoding errors, this function will return a negative value which
causes problems down the line. Check for an error and return. Also,
integer overflows are guarded.

Bug: 161894517
Test: fuzzer test case
Change-Id: Ia85067d4258bde4b875c832d6223db5dd26b8838
Merged-In: Ia85067d4258bde4b875c832d6223db5dd26b8838
(cherry picked from commit ee22384c54)
2020-08-12 21:45:05 +00:00
Steven Moreland
fdbc565dd5 String8: explicit int -> char cast.
Since tolower/toupper take and return integer arguments, ascii chars in
the extended range will be converted from positive int values to
negative char values. In order to silence an error here, which was added
recently with integer sanitization here, casting explicitly.

Fixes: 160831549
Test: w/ libutils_fuzz_string8
Change-Id: Iedcd6643f95f84ce662a80e38931d918a200f508
2020-07-13 23:33:25 +00:00
Steven Moreland
727a6dd5f5 String*: remove 'StaticLinkage' constructor
Unneeded.

Bug: N/A
Test: N/A
Change-Id: I3ff473d1e2fec98e47abd8abb45dd36e0a808170
2020-02-10 13:56:44 -08:00
Steven Moreland
0e19f3b4cc Remove utf32 functions.
These don't appear to be used by anything.

Bug: N/A
Test: binary inspection + code inspection
Change-Id: I6c12db26c320a66bcf6e28618c6e9f61b40d985e
2019-07-02 18:15:03 -07:00
Elliott Hughes
643268f325 Move system/core/ off NO_ERROR.
It causes trouble for Windows, and OK already exists.

Bug: N/A
Test: builds
Change-Id: Ida22fd658b0ebb259c710ba39049b07c9e495d9c
2018-10-08 11:15:52 -07:00
Yi Kong
e1731a4f2e [libutils] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.

Test: m
Bug: 68236239
Change-Id: I5e89ec8c42151875439d2656475a8739ab9cb7dc
2018-07-16 18:11:34 -07:00
Steven Moreland
241b93cfd3 libutils: Remove Static.cpp and darwin hacks.
Bug: N/A
Test: in internal master, the only libraries that reference this
  symbol are:
./prebuilts/sdk/tools/linux/bin/split-select android::gDarwinIsReallyAnnoying
./prebuilts/sdk/tools/linux/bin/aapt android::gDarwinIsReallyAnnoying
./prebuilts/sdk/tools/linux/bin/aapt2 android::gDarwinIsReallyAnnoying
./prebuilts/sdk/tools/linux/lib64/libaapt2_jni.so android::gDarwinIsReallyAnnoying
./prebuilts/sdk/tools/linux/lib64/libaapt2_jni.so android::gDarwinIsReallyAnnoying
+ VNDK libraries
Test: libutils_test

Change-Id: Id39e5ef6438e48fa225ba06dbb59902ca5b60f70
2018-03-06 17:44:08 +00:00
Steven Moreland
d21cfab244 Add missing includes.
Includes are transitively imported by <string> in String8.h + String16.h
but that include is being removed.

Test: pass
Change-Id: Ide5c011b40b4a4f031dd26ead08b5c8d5d299693
2017-03-10 09:05:30 -08:00
Mathias Agopian
22dbf3947f clean-up libutils includes
moved Foo.h as first include of Foo.cpp, and
removed redundant includes.

Made NativeHandle non virtual.


Test: run & compile
Bug: n/a

Change-Id: I37fa746cd42c9ba23aba181f84cb6c619386406a
2017-03-03 14:47:47 -08:00
Sergio Giro
502602366c Merge \"libutils/Unicode.cpp: Correct length computation and add checks for utf16->utf8\" into nyc-mr1-dev
am: 7714abac6b

Change-Id: I63e0299219dc1e50b31a88384fed7f3f43e9f86e
2016-07-11 12:22:43 +00:00
Sergio Giro
c4966a363e libutils/Unicode.cpp: Correct length computation and add checks for utf16->utf8
Inconsistent behaviour between utf16_to_utf8 and utf16_to_utf8_length
is causing a heap overflow.

Correcting the length computation and adding bound checks to the
conversion functions.

Test: ran libutils_tests
Bug: 29250543
Change-Id: I6115e3357141ed245c63c6eb25fc0fd0a9a7a2bb
2016-07-11 09:46:32 +00:00
Samuel Tan
95fd527065 libutils: remove whitespace from String8 files
Remove trailing whitespace from String8 header and
cpp files.

BUG: None
Change-Id: Ie77da3f0fbce9cdce20225ce1310cf62295179a4
2016-02-18 17:04:20 -08:00
Sergio Giro
b5a00d6b2e am e0453334: Merge "system/core: remove methods returning SharedBuffer in String8, String16"
* commit 'e045333445ab3ebb8d602d25ed750169f135baa6':
  system/core: remove methods returning SharedBuffer in String8, String16
2015-09-30 20:04:50 +00:00
Sergio Giro
282efae9c3 system/core: remove methods returning SharedBuffer in String8, String16
Towards deprecation of SharedBuffer

Change-Id: I3069837db32837bcc0f5d8f1118ccd502c9070dc
2015-09-30 15:42:02 +01:00
Sergio Giro
f777655d85 resolved conflicts for 6ee734cf to stage-aosp-master
Change-Id: Ia06c4d941d9b8828707299bb363f51fab5549897
2015-09-23 17:58:25 +01:00
Sergio Giro
d2529f2830 libutils: hide SharedBuffer by moving SharedBuffer.h to the implementation directory
Some methods in header files of classes using SharedBuffer need
to be moved to the implementation files accordingly

Change-Id: I891f3ace2b940ab219e4e449040bfed71c0547db
2015-09-23 16:22:59 +01:00
Abhishek Arya
64e2d8c0dc am 219a006f: am fc5fdc85: am e45d96d6: am 19398a71: am d34846b7: am cd407a17: am e0dce90b: Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
* commit '219a006f89a5448a9a6eeb1f37ad0088e85bd3f8':
  Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
2015-08-21 07:12:31 +00:00
Abhishek Arya
fc5fdc8568 am e45d96d6: am 19398a71: am d34846b7: am cd407a17: am e0dce90b: Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
* commit 'e45d96d6bf592f0ae20bb021ea529acc94e0cb55':
  Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
2015-08-21 06:54:21 +00:00
Abhishek Arya
d34846b70b am cd407a17: am e0dce90b: Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
* commit 'cd407a17fe326f3e18866ddddb1c747b06a45fc0':
  Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
2015-08-21 06:23:50 +00:00
Abhishek Arya
e0dce90b0d Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
Bug: 23290056
Change-Id: If6e22b0159de6635a8ca5305895b7718f15becc7
2015-08-20 21:55:55 -07:00
Sergio Giro
93f106b8d0 am e97682be: am a1a22b57: am e67b5848: am 4956c0fe: am 5b85b1d4: libutils: fix overflow in String8::allocFromUTF8
* commit 'e97682be0634fe773f70097bc518e5d034efe8f7':
  libutils: fix overflow in String8::allocFromUTF8
2015-08-20 22:58:19 +00:00
Sergio Giro
e67b584869 am 4956c0fe: am 5b85b1d4: libutils: fix overflow in String8::allocFromUTF8
* commit '4956c0fe1e582a8497aff34a41aeb8bf4748eef0':
  libutils: fix overflow in String8::allocFromUTF8
2015-08-20 22:28:53 +00:00
Sergio Giro
5b85b1d40d libutils: fix overflow in String8::allocFromUTF8
Patch contributed in:
https://code.google.com/p/android/issues/detail?id=182908

Bug: 23290056

(cherry picked from commit 4eeacbeec0)

Change-Id: Ife1dc0791040150132bea6884f1e6c8d31972d1b
(cherry picked from commit ebabef2752)
2015-08-18 20:52:25 +00:00
Sergio Giro
ba71601aac am 29c12755: Merge "libutils: fix overflow in String8::allocFromUTF8" into mnc-dev
* commit '29c1275519ef85fa3f30be351f19dc6e7eedbee9':
  libutils: fix overflow in String8::allocFromUTF8
2015-08-18 17:19:10 +00:00
Sergio Giro
ebabef2752 libutils: fix overflow in String8::allocFromUTF8
Patch contributed in:
https://code.google.com/p/android/issues/detail?id=182908

Bug: 23290056

(cherry picked from commit 4eeacbeec0)

Change-Id: Ife1dc0791040150132bea6884f1e6c8d31972d1b
2015-08-18 18:06:38 +01:00
Sergio Giro
4eeacbeec0 libutils: fix overflow in String8::allocFromUTF8
Patch contributed in:
https://code.google.com/p/android/issues/detail?id=182908

Bug: 23290056
Change-Id: Ide0e9a8acc4e95a9104bab3ae803aa3a40098222
2015-08-18 14:44:54 +01:00
Elliott Hughes
1f8bc86a7d Move libutils off AndroidConfig.h.
Change-Id: Ia0e4a4f968c640eb44317821d2dc6b195f9f490e
2015-07-29 14:31:54 -07:00
Andreas Gampe
dd060f01f6 System/core: Use memmove
Should use memmove when you expect overlap.

Change-Id: I268a173db40a4be54232958e37aa8a03c2a885ee
2014-11-13 15:50:17 -08:00
Jeff Brown
5ee915afe1 Add a couple of useful string functions.
Change-Id: I158f69917bab5f15482dd8f2b66b36a4cc0f11ad
2014-06-09 14:02:52 -07:00
Mark Salyzyn
5bed803664 libutils: turn on -Werror
- Deal with some -Wunused issues
- Override PRI macros (windows)
- Revert use of PRI macros on off64_t (linux)
- Deal with a gnu++11 complaince issue

Change-Id: Ie66751293bd84477a5a6dfd8a57e700a16e36964
2014-06-02 15:57:50 -07:00
Fengwei Yin
fff9d11be5 Fix undefined args access for x86_64.
From libc manual for vsnprintf:
   The  functions  vprintf(),  vfprintf(), vsprintf(), vsnprintf()
   are equivalent to the functions printf(), fprintf(), sprintf(), snprintf(),
   respectively, except that they are called with a va_list instead of a
   variable number of arguments.  These  functions  do  not  call  the  va_end  macro.
   Because they invoke the va_arg macro, the value of ap is undefined after the call.

We need to allocate/end new va_list for each vsnprintf.

Change-Id: I66ec058033be1cb918e7b2bc84ca546800da226b
Signed-off-by: Fengwei Yin <fengwei.yin@intel.com>
2014-02-27 01:17:09 +08:00
Alex Ray
d98e07fdf9 move libs/utils to libutils
Change-Id: I6cf4268599460791414882f91eeb88a992fbd29d
2013-08-02 14:40:08 -07:00
Renamed from libs/utils/String8.cpp (Browse further)