Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f6c0c3c5 authored by Cindy Zhou's avatar Cindy Zhou
Browse files

Cfi function attribute for codec factory

Declare cfi_canonical_jump_table for codec factory functions to avoid
cfi crashes.

Bug: 158010610
Bug: 173497308
Test: ran atest DecoderConformanceTest, ImageReaderDecoderTest,
VideoDecoderPerfTest, VideoEncoderTest.  Compare the
before and after enabling CFI results since there was a number of tests
that were initially failing.

Change-Id: I66f75314c32aaa2d5009f74fc764528343c012a5
parent 932a856c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1061,11 +1061,13 @@ private:

}  // namespace android

__attribute__((cfi_canonical_jump_table))
extern "C" ::C2ComponentFactory* CreateCodec2Factory() {
    ALOGV("in %s", __func__);
    return new ::android::C2SoftAacDecFactory();
}

__attribute__((cfi_canonical_jump_table))
extern "C" void DestroyCodec2Factory(::C2ComponentFactory* factory) {
    ALOGV("in %s", __func__);
    delete factory;
+2 −0
Original line number Diff line number Diff line
@@ -692,11 +692,13 @@ private:

}  // namespace android

__attribute__((cfi_canonical_jump_table))
extern "C" ::C2ComponentFactory* CreateCodec2Factory() {
    ALOGV("in %s", __func__);
    return new ::android::C2SoftAacEncFactory();
}

__attribute__((cfi_canonical_jump_table))
extern "C" void DestroyCodec2Factory(::C2ComponentFactory* factory) {
    ALOGV("in %s", __func__);
    delete factory;
+2 −0
Original line number Diff line number Diff line
@@ -420,11 +420,13 @@ private:

}  // namespace android

__attribute__((cfi_canonical_jump_table))
extern "C" ::C2ComponentFactory* CreateCodec2Factory() {
    ALOGV("in %s", __func__);
    return new ::android::C2SoftAMRDecFactory();
}

__attribute__((cfi_canonical_jump_table))
extern "C" void DestroyCodec2Factory(::C2ComponentFactory* factory) {
    ALOGV("in %s", __func__);
    delete factory;
+2 −0
Original line number Diff line number Diff line
@@ -337,11 +337,13 @@ private:

}  // namespace android

__attribute__((cfi_canonical_jump_table))
extern "C" ::C2ComponentFactory* CreateCodec2Factory() {
    ALOGV("in %s", __func__);
    return new ::android::C2SoftAmrNbEncFactory();
}

__attribute__((cfi_canonical_jump_table))
extern "C" void DestroyCodec2Factory(::C2ComponentFactory* factory) {
    ALOGV("in %s", __func__);
    delete factory;
+2 −0
Original line number Diff line number Diff line
@@ -411,11 +411,13 @@ private:

}  // namespace android

__attribute__((cfi_canonical_jump_table))
extern "C" ::C2ComponentFactory* CreateCodec2Factory() {
    ALOGV("in %s", __func__);
    return new ::android::C2SoftAmrWbEncFactory();
}

__attribute__((cfi_canonical_jump_table))
extern "C" void DestroyCodec2Factory(::C2ComponentFactory* factory) {
    ALOGV("in %s", __func__);
    delete factory;
Loading