summaryrefslogtreecommitdiff
path: root/libsi/util.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-02-19 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2006-02-19 18:00:00 +0100
commitb9bfba20f25a0562d22bb57d611abc3918e1c147 (patch)
treed90e74c79c6c30be55a9fd8c734aabdee1660a9c /libsi/util.c
parentc23992b807aca1cea08193b773f80eee0cb8f829 (diff)
downloadvdr-patch-lnbsharing-b9bfba20f25a0562d22bb57d611abc3918e1c147.tar.gz
vdr-patch-lnbsharing-b9bfba20f25a0562d22bb57d611abc3918e1c147.tar.bz2
Version 1.3.43vdr-1.3.43
- Removed an unnecessary toFile->SetReadAhead() from cutter.c (thanks to Artur Skawina). - The "Back" key now restores the original string when pressed while editing a string item (suggested by Markus Hahn). - Now stopping scanning the video directory if there are too many levels of symbolic links, which might indicate a recursive link loop (based on a patch from Helmut Auer). - Improved OSD area handling in cDvbSpuDecoder (thanks to Marco Schlüßler). - Now logging the description (if present) in case a thread is canceled (suggested by Marco Schlüßler). - cMenuText now uses the given font (thanks to Rolf Ahrenberg). - The ST:TNG skin now uses the fixed font if requested when displaying texts. - Fixed some typos in the CONTRIBUTORS file (thanks to Frank Krömmelbein). - Changed offset and size handling in 'libsi' from 'unsigned' to 'signed', so that overflows can be better detected (thanks to Marcel Wiesweg). - Checking data size in CaDescriptor::Parse() and LinkageDescriptor::Parse() of 'libsi' to avoid crashes with invalid data (thanks to Marcel Wiesweg). - Made CharArray::DataOwnData::assign() in 'libsi' more robust against invalid data (suggested by Oliver Endriss). Also changed CharArray::DataOwnData::Delete() so that it sets 'size' and 'data' to 0. - Now resetting the channel number if the number entered through the numeric keys exceeds the maximum channel number (thanks to Rolf Ahrenberg). - The language code in the 'X' component records of EPG data can now consist of two codes, separated by '+'. - If a recording starts and there is no EPG data available for the recorded channel, the 'X' audio component records for the 'info.vdr' file are now generated from the channel's PID data. - Externally provided EPG data (with table ID 0x00) now gets its component descriptors set from the broadcast data, so that language codes and descriptions are available (suggested by Andreas Brugger). - When setting the audio track descriptions, the language codes are now also set in case this is a replay session (based on a patch from Rolf Ahrenberg). - If a recording starts and the channel's audio PID data has more language code information than the EPG's component data, the code from the channel is taken. - Fixed handling DPID when deciding whether to switch to 'Transfer Mode' (thanks to Marco Schlüßler). - Fixed replaying recordings of radio channels with many audio tracks (thanks to Reinhard Nissl). - Added a comment to tChannelID::nid, explaining that is is actually the "original" network id.
Diffstat (limited to 'libsi/util.c')
-rw-r--r--libsi/util.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/libsi/util.c b/libsi/util.c
index 3465794..b0db93e 100644
--- a/libsi/util.c
+++ b/libsi/util.c
@@ -6,7 +6,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * $Id: util.c 1.5 2005/05/28 14:15:29 kls Exp $
+ * $Id: util.c 1.7 2006/02/18 11:17:50 kls Exp $
* *
***************************************************************************/
@@ -47,7 +47,7 @@ CharArray& CharArray::operator=(const CharArray &f) {
return *this;
}
-void CharArray::assign(const unsigned char*data, unsigned int size, bool doCopy) {
+void CharArray::assign(const unsigned char*data, int size, bool doCopy) {
//immutable
if (!data_)
data_= doCopy ? (Data*)new DataOwnData() : (Data*)new DataForeignData();
@@ -76,13 +76,13 @@ bool CharArray::operator==(const CharArray &other) const {
return false;
//do _not_ use strcmp! Data is not necessarily null-terminated.
- for (unsigned int i=0;i<data_->size;i++)
+ for (int i=0;i<data_->size;i++)
if (data_->data[i] != other.data_->data[i])
return false;
return true;
}
-CharArray CharArray::operator+(const unsigned int offset) const {
+CharArray CharArray::operator+(const int offset) const {
CharArray f(*this);
f.off+=offset;
return f;
@@ -117,8 +117,10 @@ CharArray::DataOwnData::~DataOwnData() {
Delete();
}
-void CharArray::DataOwnData::assign(const unsigned char*d, unsigned int s) {
+void CharArray::DataOwnData::assign(const unsigned char*d, int s) {
Delete();
+ if (!d || s > 100000 || s <= 0) // ultimate plausibility check
+ return;
size=s;
unsigned char *newdata=new unsigned char[size];
memcpy(newdata, d, size);
@@ -127,13 +129,15 @@ void CharArray::DataOwnData::assign(const unsigned char*d, unsigned int s) {
void CharArray::DataOwnData::Delete() {
delete[] data;
+ size=0;
+ data=0;
}
CharArray::DataForeignData::~DataForeignData() {
Delete();
}
-void CharArray::DataForeignData::assign(const unsigned char*d, unsigned int s) {
+void CharArray::DataForeignData::assign(const unsigned char*d, int s) {
size=s;
data=d;
}
@@ -143,7 +147,7 @@ void CharArray::DataForeignData::Delete() {
}
/*
-void CharArray::Data::assign(unsigned int s) {
+void CharArray::Data::assign(int s) {
if (data)
delete[] data;
size=s;