Fix a variety of small publicly-reported bugs.
Possible NULL dereference in cmds/bootanimation/BootAnimation.cpp. https://code.google.com/p/android/issues/detail?id=61556 Missing fclose in core/jni/android_os_Debug.cpp. https://code.google.com/p/android/issues/detail?id=61546 Bad loop guards in core/jni/android_util_Process.cpp. https://code.google.com/p/android/issues/detail?id=61557 Assignment to wrong variable in libs/androidfw/AssetManager.cpp. https://code.google.com/p/android/issues/detail?id=61560 Missing delete[]s in libs/androidfw/ObbFile.cpp. https://code.google.com/p/android/issues/detail?id=61549 Leaks on error in tools/aapt/Images.cpp. https://code.google.com/p/android/issues/detail?id=61552 Two missing fclose calls in tools/aapt/Resource.cpp. https://code.google.com/p/android/issues/detail?id=61553 Missing fclose in tools/aidl/aidl.cpp. https://code.google.com/p/android/issues/detail?id=61554 Change-Id: I5820f3824e72d07a9acb776cf0af3e7443f5694a
This commit is contained in:
@@ -468,7 +468,7 @@ static int validateAttr(const String8& path, const ResTable& table,
|
||||
value.data);
|
||||
return ATTR_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
pool = table.getTableStringBlock(strIdx);
|
||||
#if 0
|
||||
if (pool != NULL) {
|
||||
@@ -704,7 +704,7 @@ bool addTagAttribute(const sp<XMLNode>& node, const char* ns8,
|
||||
// don't stop the build.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
node->addAttribute(ns, attr, String16(value));
|
||||
return true;
|
||||
}
|
||||
@@ -755,7 +755,7 @@ status_t massageManifest(Bundle* bundle, sp<XMLNode> root)
|
||||
bundle->getVersionName(), errorOnFailedInsert)) {
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
|
||||
|
||||
if (bundle->getMinSdkVersion() != NULL
|
||||
|| bundle->getTargetSdkVersion() != NULL
|
||||
|| bundle->getMaxSdkVersion() != NULL) {
|
||||
@@ -764,7 +764,7 @@ status_t massageManifest(Bundle* bundle, sp<XMLNode> root)
|
||||
vers = XMLNode::newElement(root->getFilename(), String16(), String16("uses-sdk"));
|
||||
root->insertChildAt(vers, 0);
|
||||
}
|
||||
|
||||
|
||||
if (!addTagAttribute(vers, RESOURCES_ANDROID_NAMESPACE, "minSdkVersion",
|
||||
bundle->getMinSdkVersion(), errorOnFailedInsert)) {
|
||||
return UNKNOWN_ERROR;
|
||||
@@ -839,7 +839,7 @@ status_t massageManifest(Bundle* bundle, sp<XMLNode> root)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
@@ -923,7 +923,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
||||
// --------------------------------------------------------------
|
||||
|
||||
// resType -> leafName -> group
|
||||
KeyedVector<String8, sp<ResourceTypeSet> > *resources =
|
||||
KeyedVector<String8, sp<ResourceTypeSet> > *resources =
|
||||
new KeyedVector<String8, sp<ResourceTypeSet> >;
|
||||
collect_files(assets, resources);
|
||||
|
||||
@@ -953,7 +953,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
||||
// now go through any resource overlays and collect their files
|
||||
sp<AaptAssets> current = assets->getOverlay();
|
||||
while(current.get()) {
|
||||
KeyedVector<String8, sp<ResourceTypeSet> > *resources =
|
||||
KeyedVector<String8, sp<ResourceTypeSet> > *resources =
|
||||
new KeyedVector<String8, sp<ResourceTypeSet> >;
|
||||
current->setResources(resources);
|
||||
collect_files(current, resources);
|
||||
@@ -1048,7 +1048,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
||||
// compile resources
|
||||
current = assets;
|
||||
while(current.get()) {
|
||||
KeyedVector<String8, sp<ResourceTypeSet> > *resources =
|
||||
KeyedVector<String8, sp<ResourceTypeSet> > *resources =
|
||||
current->getResources();
|
||||
|
||||
ssize_t index = resources->indexOfKey(String8("values"));
|
||||
@@ -1057,7 +1057,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
||||
ssize_t res;
|
||||
while ((res=it.next()) == NO_ERROR) {
|
||||
sp<AaptFile> file = it.getFile();
|
||||
res = compileResourceFile(bundle, assets, file, it.getParams(),
|
||||
res = compileResourceFile(bundle, assets, file, it.getParams(),
|
||||
(current!=assets), &table);
|
||||
if (res != NO_ERROR) {
|
||||
hasErrors = true;
|
||||
@@ -1227,7 +1227,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
||||
if (table.validateLocalizations()) {
|
||||
hasErrors = true;
|
||||
}
|
||||
|
||||
|
||||
if (hasErrors) {
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
@@ -1260,7 +1260,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
||||
|
||||
ResTable finalResTable;
|
||||
sp<AaptFile> resFile;
|
||||
|
||||
|
||||
if (table.hasResources()) {
|
||||
sp<AaptSymbols> symbols = assets->getSymbolsFor(String8("R"));
|
||||
err = table.addSymbols(symbols);
|
||||
@@ -1292,10 +1292,10 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
||||
table.writePublicDefinitions(String16(assets->getPackage()), fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
||||
// Read resources back in,
|
||||
finalResTable.add(resFile->getData(), resFile->getSize(), NULL);
|
||||
|
||||
|
||||
#if 0
|
||||
NOISY(
|
||||
printf("Generated resources:\n");
|
||||
@@ -1303,7 +1303,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
||||
)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// Perform a basic validation of the manifest file. This time we
|
||||
// parse it with the comments intact, so that we can use them to
|
||||
// generate java docs... so we are not going to write this one
|
||||
@@ -1398,7 +1398,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
||||
ssize_t index = block.indexOfAttribute(RESOURCES_ANDROID_NAMESPACE, "name");
|
||||
const uint16_t* id = block.getAttributeStringValue(index, &len);
|
||||
if (id == NULL) {
|
||||
fprintf(stderr, "%s:%d: missing name attribute in element <%s>.\n",
|
||||
fprintf(stderr, "%s:%d: missing name attribute in element <%s>.\n",
|
||||
manifestPath.string(), block.getLineNumber(),
|
||||
String8(block.getElementName(&len)).string());
|
||||
hasErrors = true;
|
||||
@@ -1556,7 +1556,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -1678,7 +1678,7 @@ static status_t writeLayoutClasses(
|
||||
NA = idents.size();
|
||||
|
||||
bool deprecated = false;
|
||||
|
||||
|
||||
String16 comment = symbols->getComment(realClassName);
|
||||
fprintf(fp, "%s/** ", indentStr);
|
||||
if (comment.size() > 0) {
|
||||
@@ -1761,7 +1761,7 @@ static status_t writeLayoutClasses(
|
||||
if (deprecated) {
|
||||
fprintf(fp, "%s@Deprecated\n", indentStr);
|
||||
}
|
||||
|
||||
|
||||
fprintf(fp,
|
||||
"%spublic static final int[] %s = {\n"
|
||||
"%s",
|
||||
@@ -1806,9 +1806,9 @@ static status_t writeLayoutClasses(
|
||||
//printf("%s:%s/%s: 0x%08x\n", String8(package16).string(),
|
||||
// String8(attr16).string(), String8(name16).string(), typeSpecFlags);
|
||||
const bool pub = (typeSpecFlags&ResTable_typeSpec::SPEC_PUBLIC) != 0;
|
||||
|
||||
|
||||
bool deprecated = false;
|
||||
|
||||
|
||||
fprintf(fp, "%s/**\n", indentStr);
|
||||
if (comment.size() > 0) {
|
||||
String8 cmt(comment);
|
||||
@@ -2193,10 +2193,10 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
|
||||
|
||||
status_t err = writeSymbolClass(fp, assets, includePrivate, symbols,
|
||||
className, 0, bundle->getNonConstantId());
|
||||
fclose(fp);
|
||||
if (err != NO_ERROR) {
|
||||
return err;
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
if (textSymbolsDest != NULL && R == className) {
|
||||
String8 textDest(textSymbolsDest);
|
||||
@@ -2215,10 +2215,10 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
|
||||
|
||||
status_t err = writeTextSymbolClass(fp, assets, includePrivate, symbols,
|
||||
className);
|
||||
fclose(fp);
|
||||
if (err != NO_ERROR) {
|
||||
return err;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
// If we were asked to generate a dependency file, we'll go ahead and add this R.java
|
||||
|
||||
Reference in New Issue
Block a user