-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bugfix/bootloader_iram_overlap_check_v3.1' into 'releas…
…e/v3.1' bootloader: verify that loaded image does not overlap bootloader code (backport v3.1) See merge request idf/esp-idf!3526
- Loading branch information
Showing
4 changed files
with
93 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD | ||
// | ||
// 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. | ||
|
||
#pragma once | ||
|
||
#include <stddef.h> | ||
|
||
/** | ||
* @brief Check if half-open intervals overlap | ||
* | ||
* @param start1 interval 1 start | ||
* @param end1 interval 1 end | ||
* @param start2 interval 2 start | ||
* @param end2 interval 2 end | ||
* @return true iff [start1; end1) overlaps [start2; end2) | ||
*/ | ||
static inline bool bootloader_util_regions_overlap( | ||
const intptr_t start1, const intptr_t end1, | ||
const intptr_t start2, const intptr_t end2) | ||
{ | ||
return (end1 > start2 && end2 > start1) || | ||
!(end1 <= start2 || end2 <= start1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters