summaryrefslogtreecommitdiffstats
path: root/media/libmedia/mediarecorder.cpp
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2011-02-22 12:34:02 -0800
committerJames Dong <jdong@google.com>2011-02-22 12:34:02 -0800
commitf1d985081cff2a6aa2397c5341da8432db753211 (patch)
tree35be45778b79efba7e591ca58ff58890cc5a3574 /media/libmedia/mediarecorder.cpp
parent1de41a66e3e7b548ee44e6654580e5f6f7265b11 (diff)
downloadframeworks_av-f1d985081cff2a6aa2397c5341da8432db753211.zip
frameworks_av-f1d985081cff2a6aa2397c5341da8432db753211.tar.gz
frameworks_av-f1d985081cff2a6aa2397c5341da8432db753211.tar.bz2
Check file descriptor before passing it through binder calls
bug - 3476613 Change-Id: I858933fd2fe4c095c0bd58bf50344c47fc104be9
Diffstat (limited to 'media/libmedia/mediarecorder.cpp')
-rw-r--r--media/libmedia/mediarecorder.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/media/libmedia/mediarecorder.cpp b/media/libmedia/mediarecorder.cpp
index fd575fe..0100a17 100644
--- a/media/libmedia/mediarecorder.cpp
+++ b/media/libmedia/mediarecorder.cpp
@@ -298,6 +298,17 @@ status_t MediaRecorder::setOutputFile(int fd, int64_t offset, int64_t length)
return INVALID_OPERATION;
}
+ // It appears that if an invalid file descriptor is passed through
+ // binder calls, the server-side of the inter-process function call
+ // is skipped. As a result, the check at the server-side to catch
+ // the invalid file descritpor never gets invoked. This is to workaround
+ // this issue by checking the file descriptor first before passing
+ // it through binder call.
+ if (fd < 0) {
+ LOGE("Invalid file descriptor: %d", fd);
+ return BAD_VALUE;
+ }
+
status_t ret = mMediaRecorder->setOutputFile(fd, offset, length);
if (OK != ret) {
LOGV("setOutputFile failed: %d", ret);