mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-11-04 20:06:35 +00:00
displayid: prevent reading past EDID data.
This commit is contained in:
parent
5b366e592c
commit
576912dd55
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||||
Copyright (C) 2018-21 divingkatae and maximum
|
Copyright (C) 2018-23 divingkatae and maximum
|
||||||
(theweirdo) spatium
|
(theweirdo) spatium
|
||||||
|
|
||||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||||
@ -75,6 +75,7 @@ DisplayID::DisplayID()
|
|||||||
this->last_sda = 1;
|
this->last_sda = 1;
|
||||||
this->last_scl = 1;
|
this->last_scl = 1;
|
||||||
this->data_ptr = 0;
|
this->data_ptr = 0;
|
||||||
|
this->data_pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayID::DisplayID(uint8_t std_code, uint8_t ext_code)
|
DisplayID::DisplayID(uint8_t std_code, uint8_t ext_code)
|
||||||
@ -181,7 +182,8 @@ uint8_t DisplayID::update_ddc_i2c(uint8_t sda, uint8_t scl)
|
|||||||
if (this->dev_addr & 1) {
|
if (this->dev_addr & 1) {
|
||||||
this->next_state = I2CState::DATA;
|
this->next_state = I2CState::DATA;
|
||||||
this->data_ptr = this->edid;
|
this->data_ptr = this->edid;
|
||||||
this->byte = *(this->data_ptr++);
|
this->data_pos = 0;
|
||||||
|
this->byte = this->data_ptr[this->data_pos++];
|
||||||
} else {
|
} else {
|
||||||
this->next_state = I2CState::REG_ADDR;
|
this->next_state = I2CState::REG_ADDR;
|
||||||
}
|
}
|
||||||
@ -200,7 +202,10 @@ uint8_t DisplayID::update_ddc_i2c(uint8_t sda, uint8_t scl)
|
|||||||
if (dev_addr & 1) {
|
if (dev_addr & 1) {
|
||||||
if (!sda) {
|
if (!sda) {
|
||||||
/* load next data byte */
|
/* load next data byte */
|
||||||
this->byte = *(this->data_ptr++);
|
if (data_pos < 128)
|
||||||
|
this->byte = this->data_ptr[this->data_pos++];
|
||||||
|
else
|
||||||
|
this->byte = 0;
|
||||||
} else {
|
} else {
|
||||||
LOG_F(ERROR, "DDC-I2C: Oops! NACK received");
|
LOG_F(ERROR, "DDC-I2C: Oops! NACK received");
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||||
Copyright (C) 2018-21 divingkatae and maximum
|
Copyright (C) 2018-23 divingkatae and maximum
|
||||||
(theweirdo) spatium
|
(theweirdo) spatium
|
||||||
|
|
||||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||||
@ -76,11 +76,12 @@ private:
|
|||||||
uint8_t prev_state;
|
uint8_t prev_state;
|
||||||
uint8_t last_sda;
|
uint8_t last_sda;
|
||||||
uint8_t last_scl;
|
uint8_t last_scl;
|
||||||
int bit_count; /* number of bits processed so far */
|
uint8_t byte; // byte value being currently transferred
|
||||||
uint8_t byte; /* byte value being currently transferred */
|
uint8_t dev_addr; // current device address
|
||||||
uint8_t dev_addr; /* current device address */
|
uint8_t reg_addr; // current register address
|
||||||
uint8_t reg_addr; /* current register address */
|
uint8_t* data_ptr; // ptr to data byte to be transferred next
|
||||||
uint8_t* data_ptr; /* ptr to data byte to be transferred next */
|
int bit_count; // number of bits processed so far
|
||||||
|
int data_pos; // current position in the data buffer
|
||||||
|
|
||||||
/*
|
/*
|
||||||
uint8_t edid[128] = {
|
uint8_t edid[128] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user