Skip to content

Reject RLE-compressed BMP files #8735

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

Merged
merged 3 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 36 additions & 69 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,19 @@ msgid ""
msgstr ""

#: ports/atmel-samd/common-hal/alarm/__init__.c
#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c
#: ports/espressif/common-hal/rtc/RTC.c
#: ports/atmel-samd/common-hal/alarm/touch/TouchAlarm.c
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/busio/SPI.c
#: ports/cxd56/common-hal/analogio/AnalogOut.c
#: ports/cxd56/common-hal/busio/SPI.c ports/cxd56/common-hal/rtc/RTC.c
#: ports/espressif/common-hal/busio/SPI.c ports/espressif/common-hal/rtc/RTC.c
#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c
#: ports/mimxrt10xx/common-hal/busio/SPI.c
#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c
#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c
#: ports/raspberrypi/common-hal/alarm/__init__.c
#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/busio/SPI.c
#: ports/nrf/common-hal/rtc/RTC.c ports/raspberrypi/common-hal/alarm/__init__.c
#: ports/raspberrypi/common-hal/analogio/AnalogOut.c
#: ports/raspberrypi/common-hal/busio/SPI.c
#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c
#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c
#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c
Expand All @@ -112,6 +118,10 @@ msgstr ""
msgid "%q and %q must be different"
msgstr ""

#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "%q and %q must share a clock unit"
msgstr ""

#: shared-bindings/microcontroller/Pin.c
msgid "%q contains duplicate pins"
msgstr ""
Expand Down Expand Up @@ -206,6 +216,10 @@ msgstr ""
msgid "%q must be array of type 'h'"
msgstr ""

#: shared-bindings/audiobusio/PDMIn.c
msgid "%q must be multiple of 8."
msgstr ""

#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c
#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c
#: shared-module/synthio/Synthesizer.c
Expand Down Expand Up @@ -237,6 +251,10 @@ msgstr ""
msgid "%q step cannot be zero"
msgstr ""

#: shared-module/bitbangio/I2C.c
msgid "%q too long"
msgstr ""

#: py/bc.c py/objnamedtuple.c
msgid "%q() takes %d positional arguments but %d were given"
msgstr ""
Expand Down Expand Up @@ -415,12 +433,6 @@ msgstr ""
msgid "3-arg pow() not supported"
msgstr ""

#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c
#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "A hardware interrupt channel is already in use"
msgstr ""

#: ports/espressif/common-hal/analogio/AnalogIn.c
msgid "ADC2 is being used by WiFi"
msgstr ""
Expand Down Expand Up @@ -591,14 +603,6 @@ msgstr ""
msgid "Bit clock and word select must be sequential pins"
msgstr ""

#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Bit clock and word select must share a clock unit"
msgstr ""

#: shared-bindings/audiobusio/PDMIn.c
msgid "Bit depth must be multiple of 8."
msgstr ""

#: shared-bindings/bitmaptools/__init__.c
msgid "Bitmap size and bits per value must match"
msgstr ""
Expand All @@ -611,10 +615,6 @@ msgstr ""
msgid "Both RX and TX required for flow control"
msgstr ""

#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "Both pins must support hardware interrupts"
msgstr ""

#: shared-bindings/displayio/Display.c
#: shared-bindings/framebufferio/FramebufferDisplay.c
msgid "Brightness not adjustable"
Expand Down Expand Up @@ -800,10 +800,6 @@ msgstr ""
msgid "CircuitPython core code crashed hard. Whoops!\n"
msgstr ""

#: shared-module/bitbangio/I2C.c
msgid "Clock stretch too long"
msgstr ""

#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "Clock unit in use"
msgstr ""
Expand Down Expand Up @@ -921,9 +917,12 @@ msgstr ""
msgid "ESP-IDF memory allocation failed"
msgstr ""

#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c
#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
#: ports/atmel-samd/common-hal/ps2io/Ps2.c
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
msgid "EXTINT channel already in use"
msgstr ""
Expand Down Expand Up @@ -1076,13 +1075,6 @@ msgstr ""
msgid "Group already used"
msgstr ""

#: ports/atmel-samd/common-hal/busio/SPI.c ports/cxd56/common-hal/busio/SPI.c
#: ports/espressif/common-hal/busio/SPI.c
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/SPI.c
#: ports/raspberrypi/common-hal/busio/SPI.c
msgid "Half duplex SPI is not implemented"
msgstr ""

#: supervisor/shared/safe_mode.c
msgid "Hard fault: memory access or instruction error."
msgstr ""
Expand Down Expand Up @@ -1339,10 +1331,6 @@ msgstr ""
msgid "Mapping must be a tuple"
msgstr ""

#: shared-bindings/audiobusio/PDMIn.c
msgid "Microphone startup delay must be in range 0.0 to 1.0"
msgstr ""

#: ports/raspberrypi/bindings/rp2pio/StateMachine.c
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "Mismatched data size"
Expand Down Expand Up @@ -1512,10 +1500,15 @@ msgstr ""
msgid "No default %q bus"
msgstr ""

#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/touchio/TouchIn.c
msgid "No free GCLKs"
msgstr ""

#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
msgid "No free GLCKs"
msgstr ""

#: shared-bindings/os/__init__.c
msgid "No hardware random available"
msgstr ""
Expand Down Expand Up @@ -1705,10 +1698,6 @@ msgstr ""
msgid "Out-buffer elements must be <= 4 bytes long"
msgstr ""

#: shared-bindings/audiobusio/PDMIn.c
msgid "Oversample must be multiple of 8."
msgstr ""

#: shared-bindings/pwmio/PWMOut.c
msgid ""
"PWM frequency not writable when variable_frequency is False on construction."
Expand Down Expand Up @@ -1756,6 +1745,7 @@ msgid "Pin must be on PWM Channel B"
msgstr ""

#: ports/atmel-samd/common-hal/countio/Counter.c
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "Pin must support hardware interrupts"
msgstr ""

Expand Down Expand Up @@ -1832,6 +1822,10 @@ msgstr ""
msgid "RISE_AND_FALL not available on this chip"
msgstr ""

#: shared-module/displayio/OnDiskBitmap.c
msgid "RLE-compressed BMP not supported"
msgstr ""

#: ports/stm/common-hal/os/__init__.c
msgid "RNG DeInit Error"
msgstr ""
Expand Down Expand Up @@ -1892,10 +1886,6 @@ msgstr ""
msgid "Requested resource not found"
msgstr ""

#: ports/atmel-samd/common-hal/audioio/AudioOut.c
msgid "Right channel unsupported"
msgstr ""

#: main.c
msgid "Running in safe mode! Not running saved code.\n"
msgstr ""
Expand Down Expand Up @@ -1993,10 +1983,6 @@ msgstr ""
msgid "Stereo right must be on PWM channel B"
msgstr ""

#: ports/raspberrypi/common-hal/wifi/Radio.c
msgid "Stopping AP is not supported."
msgstr ""

#: shared-bindings/alarm/time/TimeAlarm.c
msgid "Supply one of monotonic_time or epoch_time"
msgstr ""
Expand Down Expand Up @@ -2094,7 +2080,6 @@ msgstr ""
msgid "Total data to write is larger than %q"
msgstr ""

#: ports/atmel-samd/common-hal/alarm/touch/TouchAlarm.c
#: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c
#: ports/stm/common-hal/alarm/touch/TouchAlarm.c
msgid "Touch alarms not available"
Expand Down Expand Up @@ -2186,11 +2171,6 @@ msgstr ""
msgid "Unable to find I2C Display at %x"
msgstr ""

#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
msgid "Unable to find free GCLK"
msgstr ""

#: py/parse.c
msgid "Unable to init parser"
msgstr ""
Expand Down Expand Up @@ -2663,11 +2643,6 @@ msgstr ""
msgid "can't convert %q to %q"
msgstr ""

#: py/obj.c
#, c-format
msgid "can't convert %s to complex"
msgstr ""

#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr ""
Expand All @@ -2676,18 +2651,10 @@ msgstr ""
msgid "can't convert complex to float"
msgstr ""

#: py/obj.c
#: py/obj.c py/runtime.c
msgid "can't convert to %q"
msgstr ""

#: py/obj.c
msgid "can't convert to complex"
msgstr ""

#: py/runtime.c
msgid "can't convert to int"
msgstr ""

#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ static void pinalarm_set_alarms_light(size_t n_alarms, const mp_obj_t *alarms) {
case PINALARM_ERR_NOEXTINT:
raise_ValueError_invalid_pin();
case PINALARM_ERR_NOCHANNEL:
mp_raise_RuntimeError(translate("A hardware interrupt channel is already in use"));
mp_raise_RuntimeError(translate("EXTINT channel already in use"));
default:
mp_raise_RuntimeError(translate("Unknown reason."));
}
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/alarm/touch/TouchAlarm.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
#include "shared-bindings/microcontroller/__init__.h"

void common_hal_alarm_touch_touchalarm_construct(alarm_touch_touchalarm_obj_t *self, const mcu_pin_obj_t *pin) {
mp_raise_NotImplementedError(translate("Touch alarms not available"));
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_TouchAlarm);
}
4 changes: 2 additions & 2 deletions ports/atmel-samd/common-hal/audiobusio/I2SOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t *self,
raise_ValueError_invalid_pin_name(MP_QSTR_word_select);
}
if (bc_clock_unit != ws_clock_unit) {
mp_raise_ValueError(translate("Bit clock and word select must share a clock unit"));
mp_raise_ValueError_varg(translate("%q and %q must share a clock unit"), MP_QSTR_bit_clock, MP_QSTR_word_select);
}
if (serializer == 0xff) {
raise_ValueError_invalid_pin_name(MP_QSTR_data);
Expand Down Expand Up @@ -241,7 +241,7 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t *self,
// Find a free GCLK to generate the MCLK signal.
uint8_t gclk = find_free_gclk(divisor);
if (gclk > GCLK_GEN_NUM) {
mp_raise_RuntimeError(translate("Unable to find free GCLK"));
mp_raise_RuntimeError(translate("No free GLCKs"));
}
self->gclk = gclk;

Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/audiobusio/PDMIn.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t *self,
// Find a free GCLK to generate the MCLK signal.
uint8_t gclk = find_free_gclk(clock_divisor);
if (gclk > GCLK_GEN_NUM) {
mp_raise_RuntimeError(translate("Unable to find free GCLK"));
mp_raise_RuntimeError(translate("No free GCLKs"));
}
self->gclk = gclk;

Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/audioio/AudioOut.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t *self,
}
#ifdef SAMD21
if (right_channel != NULL) {
mp_raise_ValueError(translate("Right channel unsupported"));
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_right_channel);
}
if (left_channel != &pin_PA02) {
raise_ValueError_invalid_pin();
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/busio/SPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
uint8_t dopo = 255;

if (half_duplex) {
mp_raise_NotImplementedError(translate("Half duplex SPI is not implemented"));
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_half_duplex);
}

// Ensure the object starts in its deinit state.
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/common-hal/countio/Counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void common_hal_countio_counter_construct(countio_counter_obj_t *self,

if (eic_get_enable()) {
if (!eic_channel_free(pin->extint_channel)) {
mp_raise_RuntimeError(translate("A hardware interrupt channel is already in use"));
mp_raise_RuntimeError(translate("EXTINT channel already in use"));
}
} else {
turn_on_external_interrupt_controller();
Expand Down
4 changes: 2 additions & 2 deletions ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencoder_obj_t *self,
const mcu_pin_obj_t *pin_a, const mcu_pin_obj_t *pin_b) {
if (!pin_a->has_extint || !pin_b->has_extint) {
mp_raise_RuntimeError(translate("Both pins must support hardware interrupts"));
mp_raise_RuntimeError(translate("Pin must support hardware interrupts"));
}

// TODO: The SAMD51 has a peripheral dedicated to quadrature encoder debugging. Use it instead
// of the external interrupt.

if (eic_get_enable()) {
if (!eic_channel_free(pin_a->extint_channel) || !eic_channel_free(pin_b->extint_channel)) {
mp_raise_RuntimeError(translate("A hardware interrupt channel is already in use"));
mp_raise_RuntimeError(translate("EXTINT channel already in use"));
}
} else {
turn_on_external_interrupt_controller();
Expand Down
2 changes: 1 addition & 1 deletion ports/cxd56/common-hal/busio/SPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t *
int port = -1;

if (half_duplex) {
mp_raise_NotImplementedError(translate("Half duplex SPI is not implemented"));
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_half_duplex);
}

if (clock->number == PIN_SPI4_SCK &&
Expand Down
2 changes: 1 addition & 1 deletion ports/espressif/common-hal/busio/SPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
};

if (half_duplex) {
mp_raise_NotImplementedError(translate("Half duplex SPI is not implemented"));
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_half_duplex);
}

for (spi_host_device_t host_id = SPI2_HOST; host_id < SOC_SPI_PERIPH_NUM; host_id++) {
Expand Down
2 changes: 1 addition & 1 deletion ports/mimxrt10xx/common-hal/busio/SPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
bool spi_taken = false;

if (half_duplex) {
mp_raise_NotImplementedError(translate("Half duplex SPI is not implemented"));
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_half_duplex);
}

for (uint i = 0; i < sck_count; i++) {
Expand Down
2 changes: 1 addition & 1 deletion ports/nrf/common-hal/busio/SPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static nrf_spim_frequency_t baudrate_to_spim_frequency(const uint32_t baudrate)
void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t *clock, const mcu_pin_obj_t *mosi, const mcu_pin_obj_t *miso, bool half_duplex) {

if (half_duplex) {
mp_raise_NotImplementedError(translate("Half duplex SPI is not implemented"));
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_half_duplex);
}

// Find a free instance, with most desirable (highest freq and not shared) allocated first.
Expand Down
2 changes: 1 addition & 1 deletion ports/raspberrypi/common-hal/busio/SPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
size_t instance_index = NO_INSTANCE;

if (half_duplex) {
mp_raise_NotImplementedError(translate("Half duplex SPI is not implemented"));
mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_half_duplex);
}

if (clock->number % 4 == 2) {
Expand Down
Loading