Commit 90f7f76
Marcin Radomski
Prevent truncating log tag name
The currently hard-coded limit is 23 characters. This limit originates
from the pre-Android 7.0 32-character limit on system property names,
because Android's `liblog` allows setting the log level at runtime
through `log.tag` system properties [1]. The limit meant that
"log.tag.SOMETAG" must have been shorter than 32 bytes, leaving 23 bytes
for the tag itself.
The system property length limitation was removed in [2], so since 2017
it no longer applies, and some Android components already use longer
tags [3][4].
This change increases the size of the stack-allocated buffer used for
null-terminating the tag to 128 bytes, and adds support for even longer
tags by falling back to heap-allocated CString when the tag is longer
than that. The fallback path will introduce a performance penalty, but
at the same time will allow manual level adjustment via log.tag. system
property regardless of the tag length.
[1] https://cs.android.com/android/platform/superproject/main/+/main:system/logging/logd/README.property;l=50?q=f:readme.property
[2] https://android-review.googlesource.com/c/platform/bionic/+/327226
[3] https://cs.android.com/android/platform/superproject/main/+/main:device/generic/goldfish-opengl/system/codecs/omx/plugin/GoldfishVideoDecoderOMXComponent.cpp;l=20
[4] https://cs.android.com/android/platform/superproject/main/+/main:hardware/interfaces/biometrics/fingerprint/2.2/default/BiometricsFingerprint.cpp;l=161 parent d51b7ff commit 90f7f76
1 file changed
+15
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
230 | 240 | | |
231 | 241 | | |
232 | 242 | | |
| |||
0 commit comments