From 24d3fdce2a71e77a9a062bb3bca3a784f8802b5f Mon Sep 17 00:00:00 2001 From: "yokoyama%netscape.com" Date: Thu, 1 Mar 2001 03:22:52 +0000 Subject: [PATCH] Fix for 67520; /r=ftang , /sr=brendan@mozilla.org --- intl/uconv/src/nsUCvMinSupport.cpp | 7 +++++++ intl/uconv/ucvcn/nsUCvCnSupport.cpp | 7 +++++++ intl/uconv/ucvibm/nsUCvIBMSupport.cpp | 7 +++++++ intl/uconv/ucvja/nsUCvJaSupport.cpp | 7 +++++++ intl/uconv/ucvko/nsUCvKOSupport.cpp | 7 +++++++ intl/uconv/ucvlatin/nsUCvLatinSupport.cpp | 7 +++++++ intl/uconv/ucvmath/nsUCvMathSupport.cpp | 7 +++++++ intl/uconv/ucvtw/nsUCvTWSupport.cpp | 7 +++++++ intl/uconv/ucvtw2/nsUCvTW2Support.cpp | 7 +++++++ 9 files changed, 63 insertions(+) diff --git a/intl/uconv/src/nsUCvMinSupport.cpp b/intl/uconv/src/nsUCvMinSupport.cpp index bd2308571a39..6ecefe88e998 100644 --- a/intl/uconv/src/nsUCvMinSupport.cpp +++ b/intl/uconv/src/nsUCvMinSupport.cpp @@ -152,16 +152,23 @@ NS_IMETHODIMP nsBufferDecoderSupport::Convert(const char * aSrc, if ((res == NS_OK_UDEC_MOREINPUT) && (bcw == 0)) { res = NS_ERROR_UNEXPECTED; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif break; } else { if (bcr < buffLen) { // we didn't convert that residual data - unfill the buffer src -= mBufferLength - buffLen; mBufferLength = buffLen; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif } else { // the buffer and some extra data was converted - unget the rest src -= mBufferLength - bcr; mBufferLength = 0; + res = NS_OK; } break; } diff --git a/intl/uconv/ucvcn/nsUCvCnSupport.cpp b/intl/uconv/ucvcn/nsUCvCnSupport.cpp index b34b24e45fd9..98d41b5f47eb 100644 --- a/intl/uconv/ucvcn/nsUCvCnSupport.cpp +++ b/intl/uconv/ucvcn/nsUCvCnSupport.cpp @@ -152,16 +152,23 @@ NS_IMETHODIMP nsBufferDecoderSupport::Convert(const char * aSrc, if ((res == NS_OK_UDEC_MOREINPUT) && (bcw == 0)) { res = NS_ERROR_UNEXPECTED; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif break; } else { if (bcr < buffLen) { // we didn't convert that residual data - unfill the buffer src -= mBufferLength - buffLen; mBufferLength = buffLen; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif } else { // the buffer and some extra data was converted - unget the rest src -= mBufferLength - bcr; mBufferLength = 0; + res = NS_OK; } break; } diff --git a/intl/uconv/ucvibm/nsUCvIBMSupport.cpp b/intl/uconv/ucvibm/nsUCvIBMSupport.cpp index 7fc253350ee2..dfc77d069c40 100644 --- a/intl/uconv/ucvibm/nsUCvIBMSupport.cpp +++ b/intl/uconv/ucvibm/nsUCvIBMSupport.cpp @@ -165,16 +165,23 @@ NS_IMETHODIMP nsBufferDecoderSupport::Convert(const char * aSrc, if ((res == NS_OK_UDEC_MOREINPUT) && (bcw == 0)) { res = NS_ERROR_UNEXPECTED; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif break; } else { if (bcr < buffLen) { // we didn't convert that residual data - unfill the buffer src -= mBufferLength - buffLen; mBufferLength = buffLen; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif } else { // the buffer and some extra data was converted - unget the rest src -= mBufferLength - bcr; mBufferLength = 0; + res = NS_OK; } break; } diff --git a/intl/uconv/ucvja/nsUCvJaSupport.cpp b/intl/uconv/ucvja/nsUCvJaSupport.cpp index 5ac1f821819c..8030cea9a18d 100644 --- a/intl/uconv/ucvja/nsUCvJaSupport.cpp +++ b/intl/uconv/ucvja/nsUCvJaSupport.cpp @@ -152,16 +152,23 @@ NS_IMETHODIMP nsBufferDecoderSupport::Convert(const char * aSrc, if ((res == NS_OK_UDEC_MOREINPUT) && (bcw == 0)) { res = NS_ERROR_UNEXPECTED; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif break; } else { if (bcr < buffLen) { // we didn't convert that residual data - unfill the buffer src -= mBufferLength - buffLen; mBufferLength = buffLen; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif } else { // the buffer and some extra data was converted - unget the rest src -= mBufferLength - bcr; mBufferLength = 0; + res = NS_OK; } break; } diff --git a/intl/uconv/ucvko/nsUCvKOSupport.cpp b/intl/uconv/ucvko/nsUCvKOSupport.cpp index 31f41f5d6fd2..3aab6ae8f5ba 100644 --- a/intl/uconv/ucvko/nsUCvKOSupport.cpp +++ b/intl/uconv/ucvko/nsUCvKOSupport.cpp @@ -152,16 +152,23 @@ NS_IMETHODIMP nsBufferDecoderSupport::Convert(const char * aSrc, if ((res == NS_OK_UDEC_MOREINPUT) && (bcw == 0)) { res = NS_ERROR_UNEXPECTED; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif break; } else { if (bcr < buffLen) { // we didn't convert that residual data - unfill the buffer src -= mBufferLength - buffLen; mBufferLength = buffLen; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif } else { // the buffer and some extra data was converted - unget the rest src -= mBufferLength - bcr; mBufferLength = 0; + res = NS_OK; } break; } diff --git a/intl/uconv/ucvlatin/nsUCvLatinSupport.cpp b/intl/uconv/ucvlatin/nsUCvLatinSupport.cpp index a140198da2df..995db91aa34b 100644 --- a/intl/uconv/ucvlatin/nsUCvLatinSupport.cpp +++ b/intl/uconv/ucvlatin/nsUCvLatinSupport.cpp @@ -152,16 +152,23 @@ NS_IMETHODIMP nsBufferDecoderSupport::Convert(const char * aSrc, if ((res == NS_OK_UDEC_MOREINPUT) && (bcw == 0)) { res = NS_ERROR_UNEXPECTED; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif break; } else { if (bcr < buffLen) { // we didn't convert that residual data - unfill the buffer src -= mBufferLength - buffLen; mBufferLength = buffLen; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif } else { // the buffer and some extra data was converted - unget the rest src -= mBufferLength - bcr; mBufferLength = 0; + res = NS_OK; } break; } diff --git a/intl/uconv/ucvmath/nsUCvMathSupport.cpp b/intl/uconv/ucvmath/nsUCvMathSupport.cpp index b418d1a9c074..1b62975a46aa 100644 --- a/intl/uconv/ucvmath/nsUCvMathSupport.cpp +++ b/intl/uconv/ucvmath/nsUCvMathSupport.cpp @@ -162,16 +162,23 @@ NS_IMETHODIMP nsBufferDecoderSupport::Convert(const char * aSrc, if ((res == NS_OK_UDEC_MOREINPUT) && (bcw == 0)) { res = NS_ERROR_UNEXPECTED; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif break; } else { if (bcr < buffLen) { // we didn't convert that residual data - unfill the buffer src -= mBufferLength - buffLen; mBufferLength = buffLen; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif } else { // the buffer and some extra data was converted - unget the rest src -= mBufferLength - bcr; mBufferLength = 0; + res = NS_OK; } break; } diff --git a/intl/uconv/ucvtw/nsUCvTWSupport.cpp b/intl/uconv/ucvtw/nsUCvTWSupport.cpp index fd8d5c82c6dd..3d9d3d4afe7e 100644 --- a/intl/uconv/ucvtw/nsUCvTWSupport.cpp +++ b/intl/uconv/ucvtw/nsUCvTWSupport.cpp @@ -152,16 +152,23 @@ NS_IMETHODIMP nsBufferDecoderSupport::Convert(const char * aSrc, if ((res == NS_OK_UDEC_MOREINPUT) && (bcw == 0)) { res = NS_ERROR_UNEXPECTED; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif break; } else { if (bcr < buffLen) { // we didn't convert that residual data - unfill the buffer src -= mBufferLength - buffLen; mBufferLength = buffLen; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif } else { // the buffer and some extra data was converted - unget the rest src -= mBufferLength - bcr; mBufferLength = 0; + res = NS_OK; } break; } diff --git a/intl/uconv/ucvtw2/nsUCvTW2Support.cpp b/intl/uconv/ucvtw2/nsUCvTW2Support.cpp index 5b9b2f4d8f3d..f6c606208ce7 100644 --- a/intl/uconv/ucvtw2/nsUCvTW2Support.cpp +++ b/intl/uconv/ucvtw2/nsUCvTW2Support.cpp @@ -152,16 +152,23 @@ NS_IMETHODIMP nsBufferDecoderSupport::Convert(const char * aSrc, if ((res == NS_OK_UDEC_MOREINPUT) && (bcw == 0)) { res = NS_ERROR_UNEXPECTED; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif break; } else { if (bcr < buffLen) { // we didn't convert that residual data - unfill the buffer src -= mBufferLength - buffLen; mBufferLength = buffLen; +#if defined(DEBUG_yokoyama) || defined(DEBUG_ftang) + NS_ASSERTION(0, "This should not happen. Internal buffer may be corrupted."); +#endif } else { // the buffer and some extra data was converted - unget the rest src -= mBufferLength - bcr; mBufferLength = 0; + res = NS_OK; } break; }