summaryrefslogtreecommitdiff
path: root/libutils/String8.cpp
AgeCommit message (Collapse)Author
2021-06-10Check for overflow in String8::real_append.Elliott Hughes
Bug: http://b/178822418 Test: new tests Change-Id: I73631a070ade0689441abe5645ba5a5f64a58675
2021-04-16Merge "Remove move dead code." am: acec0918e5 am: 1fc404900c am: 906a03fc49Elliott Hughes
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1677028 Change-Id: I7fb50216bcf983584f664a691321683dd79ae38d
2021-04-15Remove move dead code.Elliott Hughes
Test: treehugger Change-Id: I6a23b19d078400dfe90329a49ae1abbcb24ef2bf
2021-04-14Merge "Remove String8::toUpper()." am: 450f66bd8f am: ca3794ea68 am: 334a0b1c10Elliott Hughes
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1673886 Change-Id: Ica526ca8cb76065e4008a8dbd494beb795ea1390
2021-04-12Remove String8::toUpper().Elliott Hughes
Actually, it looks like it's only toLower() that's used, so let's remove toUpper() separately, since it's so easy. Test: treehugger Change-Id: I8fae9fa513b2a34d5bd6b3f64e9305a1ee3c1ec4
2021-04-12Merge "Remove the weird range variants of String8::toLower() and ↵Elliott Hughes
String8::toUpper()." am: 561209ee66 am: 7e7ff3635d am: 685c0c9a7f Original change: https://android-review.googlesource.com/c/platform/system/core/+/1670567 Change-Id: Iedb8ab438496e0fa3f6697fb18b060e3a1acbc89
2021-04-09Remove the weird range variants of String8::toLower() and String8::toUpper().Elliott Hughes
I want to remove these bad ASCII-only APIs completely, but it might be easier to remove the range variants first. Test: treehugger Change-Id: I4c11f959a7bd8e670708cc03281ea72e9c461ff7
2020-10-06DO NOT MERGE - Merge RP1A.201005.006The Android Open Source Project
Bug: 168212094 Change-Id: I79a7517bce1c012eac2a2a7c1c2cffc5a3516eaa Merged-In: Ia85067d4258bde4b875c832d6223db5dd26b8838
2020-08-12libutils: check vsnprintf errorSteven Moreland
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 ee22384c54d42149491c8b9dbcda0d8c5e88eddc)
2020-07-28libutils: check vsnprintf errorSteven Moreland
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
2020-07-13String8: explicit int -> char cast.Steven Moreland
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-02-10String*: remove 'StaticLinkage' constructorSteven Moreland
Unneeded. Bug: N/A Test: N/A Change-Id: I3ff473d1e2fec98e47abd8abb45dd36e0a808170
2019-07-02Remove utf32 functions.Steven Moreland
These don't appear to be used by anything. Bug: N/A Test: binary inspection + code inspection Change-Id: I6c12db26c320a66bcf6e28618c6e9f61b40d985e
2018-10-08Move system/core/ off NO_ERROR.Elliott Hughes
It causes trouble for Windows, and OK already exists. Bug: N/A Test: builds Change-Id: Ida22fd658b0ebb259c710ba39049b07c9e495d9c
2018-07-16[libutils] Modernize codebase by replacing NULL with nullptrYi Kong
Fixes -Wzero-as-null-pointer-constant warning. Test: m Bug: 68236239 Change-Id: I5e89ec8c42151875439d2656475a8739ab9cb7dc
2018-03-06libutils: Remove Static.cpp and darwin hacks.Steven Moreland
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
2017-03-10Add missing includes.Steven Moreland
Includes are transitively imported by <string> in String8.h + String16.h but that include is being removed. Test: pass Change-Id: Ide5c011b40b4a4f031dd26ead08b5c8d5d299693
2017-03-03clean-up libutils includesMathias Agopian
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
2016-07-11Merge \"libutils/Unicode.cpp: Correct length computation and add checks for ↵Sergio Giro
utf16->utf8\" into nyc-mr1-dev am: 7714abac6b Change-Id: I63e0299219dc1e50b31a88384fed7f3f43e9f86e
2016-07-11libutils/Unicode.cpp: Correct length computation and add checks for utf16->utf8Sergio Giro
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-02-18libutils: remove whitespace from String8 filesSamuel Tan
Remove trailing whitespace from String8 header and cpp files. BUG: None Change-Id: Ie77da3f0fbce9cdce20225ce1310cf62295179a4
2015-09-30am e0453334: Merge "system/core: remove methods returning SharedBuffer in ↵Sergio Giro
String8, String16" * commit 'e045333445ab3ebb8d602d25ed750169f135baa6': system/core: remove methods returning SharedBuffer in String8, String16
2015-09-30system/core: remove methods returning SharedBuffer in String8, String16Sergio Giro
Towards deprecation of SharedBuffer Change-Id: I3069837db32837bcc0f5d8f1118ccd502c9070dc
2015-09-23resolved conflicts for 6ee734cf to stage-aosp-masterSergio Giro
Change-Id: Ia06c4d941d9b8828707299bb363f51fab5549897
2015-09-23libutils: hide SharedBuffer by moving SharedBuffer.h to the implementation ↵Sergio Giro
directory Some methods in header files of classes using SharedBuffer need to be moved to the implementation files accordingly Change-Id: I891f3ace2b940ab219e4e449040bfed71c0547db
2015-08-21am 219a006f: am fc5fdc85: am e45d96d6: am 19398a71: am d34846b7: am ↵Abhishek Arya
cd407a17: am e0dce90b: Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b * commit '219a006f89a5448a9a6eeb1f37ad0088e85bd3f8': Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
2015-08-21am e45d96d6: am 19398a71: am d34846b7: am cd407a17: am e0dce90b: Fix compile ↵Abhishek Arya
failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b * commit 'e45d96d6bf592f0ae20bb021ea529acc94e0cb55': Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
2015-08-21am cd407a17: am e0dce90b: Fix compile failure after ↵Abhishek Arya
rIfe1dc0791040150132bea6884f1e6c8d31972d1b * commit 'cd407a17fe326f3e18866ddddb1c747b06a45fc0': Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1b
2015-08-20Fix compile failure after rIfe1dc0791040150132bea6884f1e6c8d31972d1bAbhishek Arya
Bug: 23290056 Change-Id: If6e22b0159de6635a8ca5305895b7718f15becc7
2015-08-20am e97682be: am a1a22b57: am e67b5848: am 4956c0fe: am 5b85b1d4: libutils: ↵Sergio Giro
fix overflow in String8::allocFromUTF8 * commit 'e97682be0634fe773f70097bc518e5d034efe8f7': libutils: fix overflow in String8::allocFromUTF8
2015-08-20am 4956c0fe: am 5b85b1d4: libutils: fix overflow in String8::allocFromUTF8Sergio Giro
* commit '4956c0fe1e582a8497aff34a41aeb8bf4748eef0': libutils: fix overflow in String8::allocFromUTF8
2015-08-18libutils: fix overflow in String8::allocFromUTF8Sergio Giro
Patch contributed in: https://code.google.com/p/android/issues/detail?id=182908 Bug: 23290056 (cherry picked from commit 4eeacbeec0ae66e9d9395abbf83666709f2e11e3) Change-Id: Ife1dc0791040150132bea6884f1e6c8d31972d1b (cherry picked from commit ebabef275283f771151ec93c17469374b789b2c8)
2015-08-18am 29c12755: Merge "libutils: fix overflow in String8::allocFromUTF8" into ↵Sergio Giro
mnc-dev * commit '29c1275519ef85fa3f30be351f19dc6e7eedbee9': libutils: fix overflow in String8::allocFromUTF8
2015-08-18libutils: fix overflow in String8::allocFromUTF8Sergio Giro
Patch contributed in: https://code.google.com/p/android/issues/detail?id=182908 Bug: 23290056 (cherry picked from commit 4eeacbeec0ae66e9d9395abbf83666709f2e11e3) Change-Id: Ife1dc0791040150132bea6884f1e6c8d31972d1b
2015-08-18libutils: fix overflow in String8::allocFromUTF8Sergio Giro
Patch contributed in: https://code.google.com/p/android/issues/detail?id=182908 Bug: 23290056 Change-Id: Ide0e9a8acc4e95a9104bab3ae803aa3a40098222
2015-07-29Move libutils off AndroidConfig.h.Elliott Hughes
Change-Id: Ia0e4a4f968c640eb44317821d2dc6b195f9f490e
2014-11-13System/core: Use memmoveAndreas Gampe
Should use memmove when you expect overlap. Change-Id: I268a173db40a4be54232958e37aa8a03c2a885ee
2014-06-09Add a couple of useful string functions.Jeff Brown
Change-Id: I158f69917bab5f15482dd8f2b66b36a4cc0f11ad
2014-06-02libutils: turn on -WerrorMark Salyzyn
- 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-02-27Fix undefined args access for x86_64.Fengwei Yin
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>
2013-08-02move libs/utils to libutilsAlex Ray
Change-Id: I6cf4268599460791414882f91eeb88a992fbd29d