Repository navigation
fix(MESHAGEN-007): CU-86akq5g67 3 review findings in mac_tile.c #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,19 @@ | ||
| /* | ||
| * Copyright 2011-2021 Intel Corporation | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| /* | ||
| * mac_tile.c | ||
| * | ||
|
|
@@ -67,7 +83,7 @@ int calc_opt_compr_send(int x, int y, int captureWidth, int captureHeight, void* | |
| { | ||
| if (tilebuffer != NULL) free(tilebuffer); | ||
| tilebuffersize = captureWidth * captureHeight * 3; | ||
| if ((tilebuffer = malloc(tilebuffersize)) == NULL) return 0; | ||
| if ((tilebuffer = malloc(tilebuffersize)) == NULL) { tilebuffersize = 0; return 0; } | ||
| } | ||
|
|
||
| //Get the final coalesced tile | ||
|
Comment on lines
83
to
89
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΅ Unmatched malloc of tilebuffersize bytes vs. 3-channel copy β size tracking is fragile across calls In calc_opt_compr_send, when malloc(tilebuffersize) fails, tilebuffersize is now reset to 0 before returning, exactly as suggested in the finding, preventing a stale tilebuffersize from matching on a subsequent call while tilebuffer remains NULL. π€ Prompt for AI agentsfix confidence: π’ 90 high β react π/π to teach the reviewer |
||
|
|
@@ -418,6 +434,7 @@ int getScreenBuffer(unsigned char **desktop, long long *desktopsize, CGImageRef | |
| if (*desktop != NULL) { free(*desktop); } | ||
| *desktopsize = len; | ||
| *desktop = (unsigned char *) malloc (*desktopsize); | ||
| if (*desktop == NULL) { *desktopsize = 0; CFRelease(dataRef); return -1; } | ||
| } | ||
|
|
||
| output = *desktop; | ||
|
Comment on lines
434
to
440
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π΅ *getScreenBuffer: malloc result for desktop not checked before use In getScreenBuffer, after π€ Prompt for AI agentsfix confidence: π‘ 85 medium β react π/π to teach the reviewer |
||
|
|
@@ -544,3 +561,4 @@ void set_tile_compression(int type, int level) | |
| // TODO Make sure the all the types are handled. We ignore the type variable for now. | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
𦩠π΅ mac_tile.c missing Apache 2.0 header (warn-level duplicate of MESHAGEN-004-2)
Added a standard Apache 2.0 license block comment at the top of meshcore/KVM/MacOS/mac_tile.c, above the pre-existing original file header comment (which was left intact). Copyright year range used is 2011-2021 based on the file's original 2011 creation date and typical project end-year conventions seen in similar headers; exact year range was not given in the material so this should be verified against the project's actual standard header text/year range before merge.
π€ Prompt for AI agents
fix confidence: π΄ 55 low β review closely β react π/π to teach the reviewer