Commit Graph

45 Commits (b49c3a083b73f6a5762f353f618a2e1fe25cf690)

Author SHA1 Message Date
Henri Beauchamp 989cfe2f70 Fix for crash in XMLRPC reply decoding on login with large inventories
Commit 2ea5ac0c43 introduced a crash bug
due to the recursive construction of the XMLTreeNode wrapper class.
The constructor of the said class typically recurses twice as many times
as there are entries in the user's inventory list.

This commit:
- Moves the fromXMLRPCValue() method and its helper functions from the LLSD
  class/module to the LLXMLNode class, where it belongs, thus making
  LLSD::TreeNode (which was a wrapper class to avoid making llcommon
  dependant on llxml, which is still the case after this commit) totally
  moot; the fromXMLRPCValue() call is now done directly on the LLXMLNode.
- Moves the XML and XMLRPC decoding code out of the HTTP coroutine
  LLXMLRPCTransaction::Handler (coroutines got an even smaller and fixed
  stack), and into LLXMLRPCTransaction::Impl::process().
- Removes XMLTreeNode entirely, fixing the crash as a result.
2024-07-08 23:18:02 +02:00
Rye Mutt 6cf176900f Add move construction/assignment support for LLSD type 2024-07-05 02:56:25 -04:00
Rye Mutt 7df1edbde1 Introduce move assignment operators for various LLSD types 2024-07-05 02:56:25 -04:00
Rye Mutt 59312bf209 Introduce string_view to LLSD map functions to reduce string temporaries 2024-07-05 02:56:24 -04:00
Alexander Gavriliuk 2ea5ac0c43 #1111 Remove xmlrpc-epi 2024-07-01 20:20:04 +02:00
Andrey Lihatskiy 1b68f71348 #824 Process source files in bulk: replace tabs with spaces, convert CRLF to LF, and trim trailing whitespaces as needed 2024-04-29 07:56:09 +03:00
Nat Goodspeed 99c040ea99 DRTVWR-575: Fix possible bad indexing in LLSD::operator[](size_t).
One could argue that passing a negative index to an LLSD array should do
something other than shrug and reference element [0], but as that's legacy
behavior, it seems all too likely that the viewer sometimes relies on it.

This specific problem arises if the index passed to operator[]() is negative
-- either with the previous Integer parameter or with size_t (which of course
reinterprets the negative index as hugely positive). The non-const
ImplArray::ref() overload checks parameter 'i' and, if it appears negative,
sets internal 'index' to 0.

But in the next stanza, if (index >= existing size()), it calls resize() to
scale the internal array up to one more than the requested index. The trouble
is that it passed resize(i + 1), not the adjusted resize(index + 1).

With a requested index of exactly -1, that would pass resize(0), which would
result in the ensuing array[0] reference being invalid.

With a requested index less than -1, that would pass resize(hugely positive)
-- since, whether operator[]() accepts signed LLSD::Integer or size_t,
resize() accepts std::vector::size_type. Given that the footprint of an LLSD
array element is at least a pointer, the number of bytes required for
resize(hugely positive) is likely to exceed available heap storage.

Passing the adjusted resize(index + 1) should defend against that case.
2023-01-04 17:18:31 -05:00
Nat Goodspeed 4349cb6165 DRTVWR-575: Address review comments on Xcode 14.1 type tweaks.
Introduce LLSD template constructors and assignment operators to disambiguate
construction or assignment from any integer type to Integer, likewise any
floating point type to Real. Use new narrow() function to validate
conversions.

For LLSD method parameters converted from LLSD::Integer to size_t, where the
method previously checked for a negative argument, make it now check for
size_t converted from negative: in other words, more than S32_MAX. The risk of
having a parameter forced from negative to unsigned exceeds the risk of a
valid length or index over that max.

In lltracerecording.cpp's PeriodicRecording, now that mCurPeriod and
mNumRecordedPeriods are size_t instead of S32, defend against subtracting 1
from 0.

Use narrow() to validate newly-introduced narrowing conversions.

Make llclamp() return the type of the raw input value, even if the types of
the boundary values differ.

std::ostream::tellp() no longer returns a value we can directly report as a
number. Cast to U64.
2022-11-12 18:59:21 -10:00
Nat Goodspeed 9522a0b7c1 DRTVWR-575: Fix llcommon assumptions that size_t fits in 4 bytes.
It's a little distressing how often we have historically coded S32 or U32 to
pass a length or index.

There are more such assumptions in other viewer subdirectories, but this is a
start.
2022-11-03 14:58:32 -04:00
Ptolemy 3a9ce9f226 SL-16606: Add profiler category LLSD 2022-01-14 11:50:19 -08:00
Dave Parks d2dce17803 SL-16197 Optimize LLEnvironment handling of shader uniforms. Instrument LLSD. Enable Fast Timers when Tracy is enabled to catch Fast Timer overhead. 2021-10-19 02:26:41 +00:00
Rider Linden d7dd10b88b Split for viewer/simhost sync LLSD with simhost. 2017-11-30 11:32:22 -08:00
Oz Linden c8726aba30 remove execute permission from many files that should not have it 2015-11-10 09:48:56 -05:00
callum_linden ade93d5d19 Update to build on Xcode 6.0: remove release build unused function 2014-10-21 11:38:20 -07:00
Brad Payne (Vir Linden) 744cf6be8d merge 2013-12-05 10:39:35 -05:00
maxim@mnikolenko aa916288b1 MAINT-3005 FIXED Set max persistent notifications to reduce log-in time 2013-08-20 12:07:54 +03:00
Brad Payne (Vir Linden) a04a706c1b merge 2013-05-21 16:18:48 -04:00
Graham Madarasz bf6182daa8 Update Mac and Windows breakpad builds to latest 2013-03-29 07:50:08 -07:00
Don Kjer f945415210 Large changes to the LLCurl::Responder API, as well as pulling in some changes to common libraries from the server codebase:
* Additional error checking in http handlers.
* Uniform log spam for http errors.
* Switch to using constants for http heads and status codes.
* Fixed bugs in incorrectly checking if parsing LLSD xml resulted in an error.
* Reduced spam regarding LLSD parsing errors in the default completedRaw http handler.  It should not longer be necessary to short-circuit completedRaw to avoid spam.
* Ported over a few bug fixes from the server code.
* Switch mode http status codes to use S32 instead of U32.
* Ported LLSD::asStringRef from server code; avoids copying strings all over the place.
* Ported server change to LLSD::asBinary; this always returns a reference now instead of copying the entire binary blob.
* Ported server pretty notation format (and pretty binary format) to llsd serialization.

* The new LLCurl::Responder API no longer has two error handlers to choose from.  Overriding the following methods have been deprecated:
** error - use httpFailure
** errorWithContent - use httpFailure
** result - use httpSuccess
** completed - use httpCompleted
** completedHeader - no longer necessary; call getResponseHeaders() from a completion method to obtain these headers.

* In order to 'catch' a completed http request, override one of these methods:
** httpSuccess - Called for any 2xx status code.
** httpFailure - Called for any non-2xx status code.
** httpComplete - Called for all status codes.  Default implementation is to call either httpSuccess or httpFailure.
* It is recommended to keep these methods protected/private in order to avoid triggering of these methods without using a 'push' method (see below).

* Uniform error handling should followed whenever possible by calling a variant of this during httpFailure:
** llwarns << dumpResponse() << llendl;
* Be sure to include LOG_CLASS(your_class_name) in your class in order for the log entry to give more context.

* In order to 'push' a result into the responder, you should no longer call error, errorWithContent, result, or completed.
* Nor should you directly call httpSuccess/Failure/Completed (unless passing a message up to a parent class).
* Instead, you can set the internal content of a responder and trigger a corresponding method using the following methods:
** successResult - Sets results and calls httpSuccess
** failureResult - Sets results and calls httpFailure
** completedResult - Sets results and calls httpCompleted

* To obtain information about a the response from a reponder method, use the following getters:
** getStatus - HTTP status code
** getReason - Reason string
** getContent - Content (Parsed body LLSD)
** getResponseHeaders - Response Headers (LLSD map)
** getHTTPMethod - HTTP method of the request
** getURL - URL of the request

* It is still possible to override completeRaw if you want to manipulate data directly out of LLPumpIO.

* See indra/llmessage/llcurl.h for more information.
2013-03-13 06:26:25 +00:00
Kelly Washington 6d3be57d33 SEC-995 FIX viewer is easily spammed to death by chat
removed a couple more unnecessary string copies from unfortunate LLSD behavior.
reviewed with simon, post review from Richard.
2012-04-25 11:26:54 -07:00
Nat Goodspeed 3e6c522084 LLSD-14: Extract remaining conditional LLSD mbrs to namespace llsd.
Per Monty's code review, it's dubious practice to have a class in which
certain members are sometimes visible, other times not. If these were virtual
methods, or non-static data members, the error would be obvious -- but even
with static data members and non-virtual methods, it looks like an ODR
violation. Extract conditional methods as free functions, as in changeset
07cd70e75473.
2011-12-06 09:54:59 -05:00
Nat Goodspeed 1a6846444f LLSD-14: Optional entry points need conditional decls turned on.
Changeset 07cd70e75473 moved LLSD::outstandingCount() and allocationCount() to
free functions so we could turn their visibility on/off via LLSD_DEBUG_INFO.
But on some platforms, without proper LL_COMMON_API declarations visible when
we compile llsd.cpp, those free functions lack proper linkage directives.
Declare LLSD_DEBUG_INFO in llsd.cpp so that when the llcommon library is
built, the free functions get proper linkage -- independent of compilations of
LLSD consumers.
2011-12-05 09:26:10 -05:00
Nat Goodspeed 95fb0249e9 LLSD-14: Move LLSD::(outstanding|allocation)Count() to free functions.
Free functions can be unconditionally compiled into the .o file, but
conditionally hidden in the header file. Static class methods don't have that
flexibility: without a declaration in the header file, you can't compile a
function definition in the .cpp file. That makes it awkward to use the same
llcommon build for production and for unit tests.
Why make the function declarations conditional at all? These are debugging
functions. They break the abstraction, they peek under the covers. Production
code should not use them. Making them conditional on an #ifdef symbol in the
unit-test source file means the compiler would reject any use by production
code. Put differently, it allows us to assert with confidence that only unit
tests do use them.
Put new free functions in (lowercase) llsd namespace so as not to clutter
global namespace.
Tweak the one known consumer (llsd_new_tut.cpp) accordingly.
2011-12-01 16:50:27 -05:00
Nat Goodspeed e97fb23218 Make LLSD diagnostic methods conditional on LLSD_DEBUG_INFO.
This establishes that there are no viewer-side unit tests relying on these
methods. The point is to try to clean up the LLSD public API. In the same
vein, remove from LLSD public API a diagnostic method which is nothing more
than an implementation detail for the corresponding LLSD::Impl method. The
same effect can be achieved by making LLSD::Impl a friend of LLSD, moving the
method with the messy signature (classic-C arrays!) into LLSD::Impl itself.
2011-11-19 10:02:20 -05:00
Nat Goodspeed b49c934bd9 LLSD-14: fixed way-too-overloaded local variable. 2011-11-17 15:03:25 -05:00
Nat Goodspeed bd5b1ed713 LLSD-14: Make dumpStats()/calcStats() implementation more robust
per Monty code review
2011-11-17 13:55:11 -05:00
Nat Goodspeed e62c691aab LLSD-14: Fix silly syntax error in subscript bounds check. 2011-11-17 10:02:05 -05:00
Nat Goodspeed cc1fb7bcac LLSD-14: Bring over llsd.{h,cpp} enhancements from server-trunk.
Because new enum values have been added to the LLSD type field, a few external
switch statements must be adjusted to suppress fatal warnings, even though we
never expect to encounter an LLSD instance containing any of the new values.
2011-11-17 08:06:31 -05:00
Oz Linden 06b0d72efa Change license from GPL to LGPL (version 2.1) 2010-08-13 07:24:57 -04:00
Kent Quirk f496c2b164 DEV-43622 : API change (no functionality change) to fix a design error in LLSD
I made it about a year and a half ago; Zero found it while reading code. I had added a return value to LLSD::insert(), but a) did it wrong, and b) broke the STL-like semantics of insert(). So I've put insert() back to returning void and created LLSD::with(), which does what my earlier insert() did. The compiler then caught all the cases where insert()'s return value were being used, and I changed those to use with() instead.
2009-12-01 20:59:08 -05:00
Richard Nelson 138bf11322 merge -r 130399-131510 skinning-21 -> viewer-2.0.0-3
DEV-11254 DEV-11254 DEV-2003: DEV-21567 DEV-37301 EXT-104 EXT-138 EXT-217 EXT-256 EXT-259 EXT-259 EXT-328 EXT-348 EXT-386 EXT-399 EXT-403 EXT-460 EXT-492 EXT-492 EXT-531 EXT-537 EXT-684

improved text editor (handles multiple fonts simultaneously as well as inline widgets)
2009-08-24 20:04:52 +00:00
Mark Palange 0274c1f2b1 Merged work for DEV-2066 (and formerly QAR-1538) in Viewer 2.
merged all changes, post copy, from the following branches:
linden/brachnes/enable-o-v
user/cg/qar-1538
user/mani/viewer2-enable-o-v
2009-07-16 17:54:58 +00:00
Aaron Brashears e3cf284388 Result of svn merge -r107256:107258 svn+ssh://svn/svn/user/phoenix/license_2009_merge into trunk. QAR-1165 2009-01-08 00:05:06 +00:00
Kent Quirk 667ca55bad svn merge -r106715:HEAD svn+ssh://svn.lindenlab.com/svn/linden/branches/q/notifications-merge-r106715 . QAR-1149 -- Final merge of notifications to trunk. 2009-01-05 18:59:12 +00:00
Bryan O'Sullivan 9db949eec3 svn merge -r88066:88786 svn+ssh://svn.lindenlab.com/svn/linden/branches/cmake-9-merge
dataserver-is-deprecated
for-fucks-sake-whats-with-these-commit-markers
2008-06-02 21:14:31 +00:00
Ryan Williams 52333fc830 svn merge -r87349:87423 svn+ssh://svn.lindenlab.com/svn/linden/branches/escrow/liquid-banjo-03-merge release dataserver-is-deprecated 2008-05-13 21:07:14 +00:00
Christian Goetze 7b7dd4e6f6 svn merge -r74808:74832 svn+ssh://svn/svn/linden/branches/qa-dpo-9a 2007-12-01 01:29:28 +00:00
Steven Bennetts 050dad0ce3 merge svn+ssh://steve@svn/svn/linden/branches/viewer-cleanup-3 -r 73026:73079 2007-11-07 22:55:27 +00:00
Aaron Brashears 5595a99623 Result of svn merge -r71162:71205 svn+ssh://svn/svn/linden/branches/new-license into release. only changes files which are not deployed or the comments section of code. 2007-10-04 23:19:43 +00:00
Aaron Brashears 4942a7b779 Result of svn merge -r70873:71086 svn+ssh://svn/svn/linden/branches/enable-exceptions into release. 2007-10-04 16:31:48 +00:00
Kelly Washington e03bb0606a merge -r62831:64079 branches/maintenance to release 2007-06-21 22:40:22 +00:00
Aaron Brashears 5cc44523f7 Result of svn merge -r57350:57790 svn+ssh://svn/svn/linden/branches/os-patches.001 into release. 2007-02-09 23:35:12 +00:00
Andrew Meadows bd48685d34 Fixed a linux build issue when the llhavok suddenly required rtti in order to link.
I added a #ifndef hack to v3math.h to eliminate LLString's from the llhavok project.
I also removed lluuid.h's dependency on LLString (using std::string) instead and
then fixed a bunch of bad dependency fallout on a few files around the project
that suddenly lost their hidden access to some fundamental includes.
The important parts were reviewed with James.
2007-02-07 20:33:52 +00:00
Mark Lentczner d0d4670f49 merge in of error-refactor-3
concludes (fixes) SL-31187
pair programmed and reviewed by markl and karen
2007-02-06 00:57:33 +00:00
James Cook 420b91db29 Print done when done. 2007-01-02 08:33:20 +00:00