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
diff --git a/media/codec2/components/flac/C2SoftFlacEnc.cpp b/media/codec2/components/flac/C2SoftFlacEnc.cpp
index 408db7e..1c0babd 100644
--- a/media/codec2/components/flac/C2SoftFlacEnc.cpp
+++ b/media/codec2/components/flac/C2SoftFlacEnc.cpp
@@ -481,11 +481,13 @@
} // namespace android
+__attribute__((cfi_canonical_jump_table))
extern "C" ::C2ComponentFactory* CreateCodec2Factory() {
ALOGV("in %s", __func__);
return new ::android::C2SoftFlacEncFactory();
}
+__attribute__((cfi_canonical_jump_table))
extern "C" void DestroyCodec2Factory(::C2ComponentFactory* factory) {
ALOGV("in %s", __func__);
delete factory;