Closed
Bug 1045950
Opened 10 years ago
Closed 10 years ago
AndroidBridge::InitCamera doesn't always pass correct width and height
Categories
(Core Graveyard :: Widget: Android, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla34
People
(Reporter: m_kato, Assigned: ckitching)
References
Details
Attachments
(1 file)
(deleted),
patch
|
kats
:
review+
|
Details | Diff | Splinter Review |
http://mxr.mozilla.org/mozilla-central/source/widget/android/AndroidBridge.cpp?mark=997-1020#1003
bool
AndroidBridge::InitCamera(const nsCString& contentType, uint32_t camera, uint32_t *width, uint32_t *height, uint32_t *fps) 999 {
...
jintArray arr = mozilla::widget::android::GeckoAppShell::InitCameraWrapper
(NS_ConvertUTF8toUTF16(contentType), (int32_t) camera, (int32_t) width, (int32_t) height);
width and height are pointer, but it passes as int32_t...
references,
http://mxr.mozilla.org/mozilla-central/source/widget/android/GeneratedJNIWrappers.cpp#815
jintArray GeckoAppShell::InitCameraWrapper(const nsAString& a0, int32_t a1, int32_t a2, int32_t a3) {
...
args[0].l = AndroidBridge::NewJavaString(env, a0);
args[1].i = a1;
args[2].i = a2;
args[3].i = a3;
...
http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/GeckoAppShell.java#2076
static int[] initCamera(String aContentType, int aCamera, int aWidth, int aHeight) {
...
Reporter | ||
Updated•10 years ago
|
OS: Windows 8.1 → Android
Hardware: x86 → All
Assignee | ||
Comment 1•10 years ago
|
||
Surely this is really "AndroidBridge::InitCamera doesn't never passes correct width and height"?
Looks like all we need to do is dereference the pointer and everything is fine. Have a patch.
Attachment #8464861 -
Flags: review?(bugmail.mozilla)
Assignee | ||
Comment 2•10 years ago
|
||
s/doesn't never/never/
E_INSUFFICIENT_CAFFIENE
Comment 3•10 years ago
|
||
Comment on attachment 8464861 [details] [diff] [review]
Dereference offending pointer
Review of attachment 8464861 [details] [diff] [review]:
-----------------------------------------------------------------
If you don't need the cast from uint32_t -> int32_t then might as well remove the one on the |camera| argument as well. r=me with consistent casting across the three args.
Attachment #8464861 -
Flags: review?(bugmail.mozilla) → review+
Assignee | ||
Comment 4•10 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #3)
> Comment on attachment 8464861 [details] [diff] [review]
> Dereference offending pointer
>
> Review of attachment 8464861 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> If you don't need the cast from uint32_t -> int32_t then might as well
> remove the one on the |camera| argument as well. r=me with consistent
> casting across the three args.
AAAA!
Very much insufficient caffiene: The cast is most definitely required: Java doesn't have unsigned ints, so what I just wrote may cause much badness.
This, then, is the line we are looking for:
jintArray arr = mozilla::widget::android::GeckoAppShell::InitCameraWrapper
(NS_ConvertUTF8toUTF16(contentType), (int32_t) camera, (int32_t) *width, (int32_t) *height);
Assignee | ||
Comment 5•10 years ago
|
||
(In reply to Chris Kitching [:ckitching] from comment #4)
> Very much insufficient caffiene: The cast is most definitely required: Java
> doesn't have unsigned ints, so what I just wrote may cause much badness.
>
> This, then, is the line we are looking for:
>
> jintArray arr = mozilla::widget::android::GeckoAppShell::InitCameraWrapper
> (NS_ConvertUTF8toUTF16(contentType), (int32_t) camera, (int32_t)
> *width, (int32_t) *height);
And I'm being a moron again, because casting. Blech.
... I'm genuinely surprised my first patch even compiled now. Pretty sure the generated code only takes signed... is an implicit cast occurring?
I'm just going to shut up until after coffee.
Assignee | ||
Comment 6•10 years ago
|
||
Comment 7•10 years ago
|
||
Assignee: nobody → chriskitching
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
Updated•3 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•